My 8yr old had just finished his amazing Lego Saturn V rocket and it just sat on his table looking a bit sad.. so we decided we needed MORE to show this off!
The photos of the Saturn V floodlit on the launchpad at night look amazing, so we started the project to recreate this on a smaller scale.
Project aims:
Shopping list:
Super bright 10mm LED - https://goo.gl/c6EWjA = £1.77
4 x 220Ω resistors (in the Super Starter Kit)
Total cost around £70, or cheaper if you've got some spare parts already.
The first requirement was to build a shelf to support the rocket and also contain all of the electronics.
At the end of this, you'll have a shelf that looks great, now, onto the electronics!
Getting started
We knew we wanted this to look like floodlights, and not just on / off, and it also had to have a 'wow' factor - so, time to learn some Ardunio and make this remote controlled!
If you haven't used Arduino's yet (I hadn't) don't be phased, they're simple computers that have inputs + outputs that are perfect for a project like this. I won't go into details of how to write a sketch (Arduino programme) or connect it up as there are many more full-featured articles on this. However, I do fully recommend picking up an Arduino starter kit, they come with excellent examples and allow you to (as we did) cut/chop/change bits of programme to make what you want.
Get started with this - Elegoo UNO Project Super Starter Kit https://goo.gl/ZaFmdT
To write the code we took bits of the following example code supplied in the kid:
By hacking these together after a bit of fiddling we ended up with a program that:
Making it work
The Elegoo set comes with an Arduino UNO which is excellent to learn on, however, it has limitations on the number of IO pins, and specifically pins that can do PWM - which is basically an ability to turn on and off VERY quickly, and this is the function we use to dim the leds.
So the first prototype was on the UNO, but due to using the IR code we only had 4 PWM pins, not enough.
Version 2 used an Arduino Nano - but the same problem persisted (At this time I was trying to work out why a PWM output wasnt working - the answer is that the IR code uses one of the pins as its clock).
So... Version 3 and final uses an Ardunio Mega 2560 - another Arduino board, with many more PWM pins
Wiring it up
The various INputs (IR receiver + button) connect to two pins, and the OUTputs connect to other pins. In Arduino you define these in the Sketch (Arduino program).
Upload the sketch
If you've not used Arduino before make sure you've played with the starter kit first, this will help you get through this.
Troubleshoot
If it doesn't work then use the Serial Monitor to look at the output, when you press buttons are the commands registering, if not you may need to look at your IR codes to see if they match.
Play!
Keep the board powered up by your PC and it should all work, if so then on to the next step!
The next step is taking the prototype circuit layout and soldering it onto the more permanent prototype board.
The prototype board sits on top of the Arduino and allows you to permanently solder on items, this makes it neat and tidy.
The LEDs
To achieve this we placed 5 connector blocks in the middle of the board, on the underside of the board the left pins were all soldered to a common ground. This was done by cutting small pieces of spare resistor wire and soldering one end, then the other, then trimming.
The positive (right hand) connection was soldered to one end of a resistor, and the other end of the resistor was poked through the corresponding PIN port (PINs 4 > 8)
The IR receiver
We soldered a 3 wire cable to the IR receiver making sure the black + red went to positive and negative on the IR receiver, and the other wire was then the signal (which connects back to pin 3), and the positive goes to +5v, and the negative to GND.
Having the IR receiver on a wire means that placement later on is flexible
The switch
This is simply wired to GND and PIN 9
Power
If power is plugged straight into the Arduino it means that if someone (the 3yr old!) pulls on the cable all of the wiring + board will be ripped out, which would be sad day... So...
We took a spare female power socket and soldered this to the board, this will be glued vertically on the shelf so any pull will just disconnect the wire.
To power the board you should be able to use any 7v > 12v power supply, so I used a 12v DC power supply..and then smelt burning and saw 'magic' smoke coming from the board. Tears ensued. I tested the '12v' supply and found it was putting out 16 volts, so it had fried the board....
Lesson learned, before powering the Arduino with a power supply, check it on a multimeter that it is really the voltage it says it is.
The board is now powered by a 9v 1A supply and it works perfectly.
Rather than just stick the board to the shelf we had some mounting poles from an old project, so we screwed these to the board and then to hot glued them in place.
Mounting the switch
Hot glue (LOTS of hot glue) holds this in place, it's easy to find and operate
Mounting the spotlights
Mounting the power
Got glue (LOTS!) this to the back of the board - I made a mistake and did this on the wrong side.
Mounting the IR receiver
I used a spare piece of plastic to lower the receiver so that it peeks out from underneath the shelf, as the IR needs line of sight (or at least nearly) to work properly)
Mount the shelf