95. Uplighter

Uplighter 3: Electronics

LEDs
IMG_20170327_181551.jpgThere are four 10 Watt LEDs – red, yellow and 2 x white. They are screwed to the top of the heatsink, so they point upwards. I added a tiny amount of thermal paste between the LEDs and the heatsink so that the heat is conducted across any gaps between the two. [Originally I used two cold white LEDs, but later changed them to warm white because the cold ones were, well cold!]

As with previous projects, I used a series resistor to limit the current in each LED to 1 Amp. Each LED requires a different voltage for the same current. I calculated the resistance required for each LED by using a bench power supply to adjust the voltage until the (cold) LED uses 800mA. Then I calculated the resistor necessary for a power supply voltage of 12 Volts. This allows for small variations in supply voltage and increased current as the LED heats up.

Controller
For previous projects I used an Arduino nano. It’s pretty much like the standard workhorse, the Uno, just physically smaller. Last year I bought five nanos on eBay for £2.39 each, and I have a couple left, so I used one of those.

IMG_20170220_151525

The nano has a little problem. When you first power it up, the outputs tend to go to the High state for a few seconds until the program starts (the delay is from the “bootloader” which checks to see if you’re trying to reprogram it). This is a problem for an uplighter that’s going to sit in my bedroom because, if the power goes off in the middle of the night for a short time, the light will come on full for those few seconds when the power returns. I don’t want to be woken in the middle of the night, so I added a 555 timer; on powerup it starts its timing; after 5 seconds the output goes high which enables the LEDs. It took a bit of doing to get the timer to do that properly!

Logic
The other thing is that the LEDs give out quite a bit of heat. If the lamp were to be covered it could overheat. So I’m also going to add external logic to monitor the heatsink temperature and shut off the LEDs if the temperature gets too high. This is the logic I’m using:

Control circuit

The main logic IC has four AND gates; each one controls an LED. The LED will only light if the output from it’s controlling gate is high. The logic works as follows:

  • Each AND gate is high when both the output from the Arduino and the control input are high.
  • The control input comes from a NAND gate on the second IC. This gate is high when the resistor/thermistor (on the heatsink) pair are outputting above the turn-on voltage (i.e. not it’s too hot) and the output from the 555 timer is low (i.e. not too soon). (The 555 timer turns on as soon as it’s powered up, then after its 5 second timing sequence it turns off.)

The PCB
Once upon a time, I built everything on custom PCBs. I’d draw the design on the copper with an acid-resist pen and etch the rest away using ferric chloride. For some reason I haven’t gone back to that. Maybe it seems a bit old fashioned. At the moment, I’m creating a board design for another project using the Eagle software and I plan to have boards made professionally. Meanwhile, for this project I chose the basic method of strip board (Veroboard). I designed the component layout on paper first:

PCB layout

So, we have the nano and three ICs. The other thing on the PCB is the remote control module. It’s 315MHz, rather than infra-red (like a TV remote). It has four channels (i.e. four buttons on the remote control), which are usually low, and output 5 Volts (high) while the respective button is held down. There’s also a 5th output which goes high when any of the main four go high; this means you only need to check one output to see if anything’s being pressed, rather than keep checking all four. I bought two, from different supplies. One of them came with a short antenna on the receiver board – a small coil of wire. I tried both, and the antenna didn’t seem to make any difference when in the same room. There’s also a telescopic antenna on the transmitter. Again, extending this or not didn’t seem to make any difference.

I found that the system works well, provided you press the buttons at a leisurely rate – tapping them has no effect. There is the problem that you can’t have two devices in the same house as they would interfere with each other (and any that the neighbours have!) – maybe it’s best without the antenna on the receiver. My only real annoyance is that they are not supplied with batteries – despite what the eBay advert may say!

There’s a voltage divider (resistors and a 5 Volt zener diode) which I use to test the supply voltage. This tells the Arduino what the supply voltage is (12 Volts is reduced to about 4 Volts – the zener prevents it exceeding the 5 Volt maximum input). This arrangement has two functions. Firstly, if somebody plugs in the wrong power adapter (e.g. a 16 Volt netbook supply) the LEDs won’t come on, as they would be damaged. Secondly, if the power supply goes a bit over 12 Volts (say, 12.5 Volts) the Arduino reduces the LED brightness slightly. This prevents long-term damage from correct, but imperfect, power supplies.

Finally, I also added a 9 Volt voltage regulator – the regulator on the Arduino is really at its maximum with 12 volts, and might be damaged if there were a voltage surge. And I also added a thermistor on the board, connected to one of the analogue inputs. This allows the Arduino to monitor the interior temperature of the lamp. Yes, ok, I am a bit obsessed with safety, but I do want to sleep soundly. So, here’s the finished main board, attached to the frame:

IMG_20170318_235622

Transistors.jpgThe main board connects to a smaller board that is used to switch the LEDs. It’s similar to the one I made for the “Paul Conneally” project – a small piece of blank PCB with lines routed manually using a Dremel on a stand – onto which I hand soldered four surface-mount MOSFETs (you can just about see them in the photo). In addition, being somewhat paranoid, I added another small board with four 1 Amp fuses, one for each LED, just to be on the safe side.

Clock
argos-clockThe other part is the clock. It’s a basic digital alarm clock which I modified by taking off the back, unsoldering the sounder and connecting two wires to it. I added a phono socket (I know phono is for audio, but I have plenty) and another socket on the underside of the lamp. There’s a 33k resistor in series with the clock output to protect it from short circuits.

Modified clockWhen the alarm goes off it produces just over 1 Volt (pulsed on and off a few times per second and increasing to one Volt over several seconds). This means that the Arduino needs to use the analogue input to test the voltage as 1V is not enough to be seen as logic “high”. It works well. The only problem is that when you are setting the alarm the clock originally made a “beep” every time you pressed a button. Now, there’s no beep, but sometimes the lamp picks this up as an alarm and starts the dawn routine. This can be fixed in software, when I get time, since the setting and alarm outputs are different.

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s