Lots of code changes and some hardware. Here’s some of them:
- Added ShiftBright RGB LED to pins D2, D12 and D13
- Added code for ShiftBright
- Updated DEBUG routines
- Day overhead handling is updated to wait longer before turning off
- Added yellow and red LED indications for day overhead conditions
- Night cold conditions are mirrors of day as appropriate
- Switch 1 is now only for UV lights
- Switch 2 is only for heat- in my case the heat rock is on all the time and the heat lamp is switched
- Cleaned some functions of unneeded statements
Version 5 should be released soon. It’s still not running live yet. If you want an advance copy let me know.
For my LCC project I decided to use a 2N4401 NPN transistor to control status LEDs and AC Switches. I did this so that the power draw from the Arduino chip would be as low as possible.
Below is a diagram of how this works. I used a 2N4401 NPN transistor that “turns on” when the gate goes high or positive. This essentially allows it to switch the negative or ground leg of the circuit. I did this because the Arduino can’t turn a digital IO line to ground- just 0v or 5v. Continue reading “Using a Transistor to Control an LED or anything”
Below is the breadboard circuit diagram. It’s pretty final. I hope to clean it up a bit when the project is final.
The major additions in this rev is that I’m using transistors against the Arduino digital outs to control the AC relays and a corresponding LED indicator. The on/off switches in those circuits provide a bypass to turn on the AC switches if necessary.
The Lizard Climate Control system has these requirements (updated as they change):
- turn lights and heaters on/off at specified times
- maintain specified temperatures during day and night
- report current temperature/humidity both locally (at cage) and remotely via internet
- manual bypass of Arduino control of AC switches
- built in fail-safe for over temperature situations
- protect sensors from lizard and other in-cage hazards
- visual indication of temperature situation (green=good, red=bad etc)
- document it!
On my last project– which still isn’t done yet- the buttons for changing the temp display are very unresponsive.
The reason of course is because the Arduino has to loop through all the main code before getting around to checking the button status.
I found the cure! Interrupts!
EngBlaze has a great write up on how to use this. Whew! One less I have to write! Read it here. I’ll be modifying the Tri-Temp code to use interrupts soon. Sweet!