Red Light Green Light Automaton

by Loonmos in Circuits > Arduino

78 Views, 0 Favorites, 0 Comments

Red Light Green Light Automaton

final pic 2.png
final pic 1.png
Red Light, Green Light Automaton

For a school course, we had to make something using Arduino. I decided to make a dragon against which you can play the game 'Redlight, Greenlight'. The reason I wanted to make this is because I was interested in automatons and wanted to make one with which you could interact. This is my first project using Arduino and electronics.

How the game works:

When you push the button, the game starts and you get ten seconds to walk backwards. The furthest you can walk back is 7 meters.

In the redlight state, you cannot move. This is indicated by the red light being on and the dragon moving. If you move, the light will start to flicker and you will hear a sound. This means you have lost the game.

In the greenlight state, you are allowed to move. This is indicated by the green light. When you press the button in this state, you win the game. This will also cause the light to flicker and a sound to be played.

A sound will indicate the start of each round.


Crochet

For this project I crocheted the dragon and it is recommended that you are an intermediate level crocheter if you want to make it. I used and changed an online pattern by Ima Bird on Ribblr to make this dragon. You can find this pattern here.

Crochet abbreviations used:

  • mr = magic ring
  • sc = single crochet
  • inc = increase
  • dec = decrease
  • hdc = half double crochet
  • dc = double crochet
  • tc = triple crochet
  • quac = quadruple crochet
  • quic = quintuple crochet
  • sexc = sextuple crochet
  • sepc = septuple crochet
  • octc = octuple crochet

Supplies

Circuit:

  • 1 Arduino Uno R3
  • 1 USB cable
  • 1 Breadboard or prototype board
  • 1 Green LED
  • 1 Red LED
  • 1 10kΩ resistor
  • 2 330Ω resistors
  • 1 SG90 mini servo
  • 1 Buzzer
  • 1 PIR motion sensor
  • 1 Button
  • 1 Powerbank (5V)
  • 16 M/M cables
  • 11 M/F cables
  • 1 Button cap

Dragon:

  • 2 balls of medium weight yarn
  • 1 3 mm hook
  • 1 Sewing needle
  • Stuffing
  • 2 10 mm safety eyes
  • Iron wire
  • 2 stitch markers (optional)
  • 10 pins (optional)

Casing:

  • 3 mm mdf (at least 58 cm by 32 cm)

Tools:

  • Lasercutter
  • Soldering equipment
  • Pliers
  • All purpose glue
  • Glue gun
  • Sanding paper
  • Tape

Proces

Schermafbeelding 2024-03-30 200557.png
first prototype.png
second circuit.png
RL GL Automaton Prototype

I started this project with a quick sketch.

After that I started building the circuit. I didn't have the motion sensor yet, so coded the basics of the game. I made functions for red light and green light, added a sound when they switched and made the servo move during red light.

Then the PIR motion sensor arrived, so I could start making the final design. I added the motion sensor and a button to the circuit and upgraded the code. This time I made actual states, coded the movement checking and added an end to the game.

Build the Circuit

ITTT.png
IMG_5507.jpg
IMG_5508.jpg
pir side.png
pir up.png
servo rotation.jpg

I made the wires in the schematic the same colours as the wires I used. The two 330Ω resistors were used for the LEDs and the 10kΩ one for the button.

Make sure that the PIR is set up as shown above with the jumper set in the H position and both the sensitivity and timeout length turned all the way counterclockwise.

When setting up the servo, make sure it rotates in the direction shown in the picture.

Download and Upload the Code

Attached is the code I wrote. Simply download it and upload it to the Arduino.

Downloads

Make the Dragon Head

dragon head2.png
dragon head1.png

I made my own pattern to make the head of the dragon. I had to edit this pattern because I made the stitch count end on 20 instead of 24. This is why my dragon head looks a bit crooked when its sewed on.

The steps are as followed:

1 | mr 4 (4)

2 | inc around (8)

3 | inc around (16)

4 | 2inc, 5sc, 3inc, 5sc, inc (22)

5 | 2inc, 9sc, 3inc, 9sc, inc (28)

6 | (sc, inc) around (42)

7-12 | sc around 6 times (42)

13 | (sc, dec) around (28)

Attach the eyes between rounds 10 and 11 on opposite sides of the head

14 | (5sc, dec) around (24)

15 | sc around (24)

Put some stuffing in

Make the Dragon Body

dragon body.png

For the dragons body I did follow the pattern, but I changed some steps along the way. My changes/comments will be in cursive.

The steps are as followed:

1 | chain 24 (24)

2-3 | sc around two times (24)

4 | (inc, 5sc) around (28)

5 | sc around (28)

Use a stitch marker to mark the start/end of each row (update it as you go so marker stays on the side of the head (if you are a few stitches short after a row sc until you get to the marker)) I used a small piece of yarn for this

6 | 2sc, inc, 3sc, inc, 2sc, then sc around (31)

7 | 3sc, inc, 2sc, inc, 2sc, inc, 2sc, inc, 3sc, then sc around (35)

8-16 | sc round 9 times (35)

Place a 2nd marker in the middle of side 1 (side where you have inc stitches)

17 | sc until 4th stitch from 2nd marker, then dec, 5sc, dec, then sc around to 1st marker (33)

18 | sc until 3rd stitch from 2nd marker, then dec, 3sc, dec, then sc around to 1st marker (31)

19 | sc around (31)

Make sure markers are centered on the side and middle respectively as you continue

20 | sc until 6th stitch from 2nd marker, then dec, 2sc, dec, sc, dec, 2sc, dec, then sc around to 1st marker (27)

21 | sc around (27)

22 | sc until 6th stitch from 2nd marker, then dec, 2sc, dec, sc, dec, 2sc, dec, then sc around to 1st marker (23)

23-25 | sc around 3 times (23)

Fill the body with stuffing as you go

Remove middle marker

26 | 6sc, dec, 6sc, dec, 7sc (21)

27-28 | sc around two times (21)

29 | (5sc, dec) around (18)

30 | sc around (18)

31 | (4sc, dec) around (15)

32 | sc around (15)

33 | (3sc, dec) around (12)

34-35 | sc around two times (12)

36 | (4sc, dec) around (10)

37-40 | sc around four times (the original says eight) (10)

41 | (3sc, dec) around (8)

42-45 | sc around four times (the original says nine) (8)

46 | (2sc, dec) around (6)

47-50 | sc around four times (the original says nine) (6)

51 | (sc, dec) around (4)

52-54 | sc around 3 times (4)

Fasten off

Make the Dragon Wing Arms

dragon arm 2.png

For the dragons wing arms I followed the pattern.

The steps are as followed and you need to make two of these:

1 | mr 4 (4)

2-3 | sc around 2 times (4)

4 | sc, inc, 2sc (5)

5-6 | sc around 2 times (5)

7 | 2sc, inc, 2sc (6)

8-17 | sc around 10 times (6)

18 | 2sc, inc, 2sc, inc (8)

19-21 | sc around 3 times (8)

22 | 2sc, inc, 2sc, inc, 2sc (10)

Fasten off and lightly stuff

Make the Dragon Wings

IMG_5493.jpg
dragon wing wiring.png
IMG_5494.jpg

For the dragons wings I followed the pattern, but I changed some steps along the way. My changes/comments will be in cursive.

The steps are as followed and you will need to make 2 of these:

Slip stitch into the tip of the wing arm

1 | chain 30 (30)

2 | sc until you get to the bottom of the wing arm, then flip the wing around (52)

3-13 | repeat step 2 11 times (you want 12 rows of sc in total) (52)

14 | 1quic, 1quac, 3tc, 3dc, 3hdc, sc, 3hdc, 3dc, 3tc, 1quac,

5tc, 5dc, 5hdc, 2hdc, 2dc, 2tc, 2quac, 2quic, 2sexc, 2sepc, 1octc (52)

15 | 1 round of sc (52)

Fasten off

After you have crocheted the wings, you will need to reinforce them using iron wire. You will need to reinforce the wings both horizontally and vertically (see the picture). Horizontally at the top and the bottom and vertically at both ends of the wings and at the end of the wing arm. You do this by taking a piece of iron wire and weaving it through the stitches.

Make sure to cut off the ends of the wires, so that you can't see (most) of them from the top.

Make the Dragon Horns

IMG_5501.jpg

For the dragons horns I followed the pattern, but I changed some steps along the way. My changes/comments will be in cursive.

The steps are as followed and you need to make two of each horn.

Large horn:

1 | mr 4 (4)

2 | inc around (8)

3-9 | sc around 7 times (8)

Fasten off and stuff lightly when sewing onto head at the end


Medium horn:

1 | mr 4 (4)

2-5 | sc around 4 times ( the original says 2 times) (4)

6 | (sc, inc) around (6)

Fasten off and stuff lightly when sewing onto head at the end


Small horn:

1 | mr 4 (4)

2 | sc around 3 times ( the original says 2 times) (4)

Fasten off and stuff lightly when sewing onto head at the end

Sew the Dragon Together

dragon parts.png
dragon horns sew 1.png
dragon horns sew 2.png
dragon wing sew.png
sewn dragon.png

First you sew the horns onto the head. I planned where I would place the horns by marking the position of each stitch with some pins (see picture). In the picture you can see I sewed the horns on last, that is because I made them at the very end.

Then you sew the body and head together. You do this by simply lining up the head so that the eyes are on each side of the body. The flatter part is the top of the body and the bumpier is the bottom side (see the picture).

Lastly you attach the wings on each side of the body with the wired side down. I again planned this out using pins (see picture).

Make the Casing

cardboard casing front.png
cardboard casing inside.png
inkscape file.png
cut casing.png

I made a prototype of the casing with cardboard. I remade this casing digitally using MakerCase for the shape of the box and Inkscape to cut shapes out and make extra pieces.

On the front, I cut out holes for the motion sensor and the two LEDs. On the left side, a box was cut out for the USB cable. Holes for the button and the automaton wires were cut out of the top panel.

I made four sets of extra parts for inside the box. The first being the divider between the circuit and the automaton wires. Second and third are the support for the servo and the iron wire holder. Last is the button support.

The size of the schematic is roughly 58 cm in width and 32 cm in height.

In the picture of the schematic, I labelled all the parts. The part with a cross on it, is a part I didn't use.


After making this, I used a lasercutter to cut out the box and parts. Make sure to check if all the parts fit into their cut out boxes. If not, use sanding paper to make the holes bigger. I had to sand down the holes for the motion sensor, usb cable and button.


I wasn't able to upload the dxf file, so attached is the Inkscape file. Open this file in Inkscape and save it as a dxf file for lasercutting.

Downloads

Assemble Part One

casing empty inside.png
wire holder pieces.png
wire holder down.png
inside with divider.png
inside with wire and servo holder 2.png
button holder 2.png
button holder.png

First you use the all-purpose glue to put most of the box together. Save the top and the back sides for later, this makes it easier to work on the inside.

Next you make the wire holder. Make sure to use the slightly smaller pieces for the two sides where the hole is (see picture).

Then you glue the wire and servo holder to the inside of the box. Place both parts 10 cm from the bottom. Make sure both pieces are centered (see picture).

I ended up using the divider part as a breadboard/prototype board holder rather than a divider. I didn't need to protect the automaton wire from my cables, because I cut them as short as possible. This also caused my prototype board to float in the air when I put the LEDs and motion sensor in place. I glued it 2 cm from the bottom and I used a glue gun for this.

Lastly you assemble the button holder and use a glue gun to stick it to the top panel (see picture). Use the piece of 2 x 1 cm as the top part. Use as much glue as you need to make it stick (I ended up using a lot more glue than shown in the picture).

Make the Automaton Wire

wiring info.png
wire holding dragon up.jpg
insert dragon hook.png

To make the parts of the dragon go up and down, I used a piece of iron wire. I bended this into the following shape (see picture). In the picture you can also see all the different measurements. Tape one end of the wire to the servo's rotation part and stick the other end into the wire holder (see picture).

While assembling the automaton, I quickly realised that the dragon was both too big and too heavy for my original plan. I did not want to throw away my dragon however, so I made it lay on top of the box rather than fly in the air.

Cut a piece of iron wire that is 13 cm long. Curl up one end using pliers and slide it onto the automaton wire (see picture). Put the wire through the centre hole at the top and create a hook. Push this hook through some stitches right before the head of the dragon (see picture). After making sure this works, remove the dragon again because we will add it at during the next step.

Use the glue gun to put glue on both sides of the wire that is holding the dragon up (see picture).

Assemble Part Two

inside parts glued.png
wiring glued.png
better citcuit insde.png
button in place.png
button in place 2.png
dragon in place.png
glued top with dragon.png

Use a glue gun to glue the LEDs, motion sensor and servo to the casing (see picture).

Remove the tape from the movement wire and glue it to the servo rotation part.

Put the circuit into the box.

Position the button at the button holder and put the cap on it from above.

Glue the top and back panels to the rest of the box using all-purpose glue.

Once that is all done, put the dragon back in its place and use the pliers to curl the wire up (see picture).

Reflection

I really enjoyed working on this project. Seeing as this was my first time working with Arduino, I learned a lot of new things such as: coding with Arduino, how electronics work, lasercutting, using Inkscape and soldering. It was also fun to incorporate my hobby of crocheting into this project, I think the dragon turned out really cute. I am really glad the project ended up working.