Updated 2014.07.20
List of newly found excellent references
- Using Bipolar Transistors As Switches
- Driving an LED with or without a resistor
- Using Transistor as a Switch
- What determines how much current can flow through a 2N2222 A?
- I2C bus interface
Tip122 from Arduino
Good quick reference (has all parts) of NPN PN2222A transistor
Update 2014.07.19 10.26 - Grrr
Grrr so - micro controllers a pretty whimpy for sourcing or sinking current. Regrettably, so is the PCF8574 io expander. And more Grrr ! the 8 X Relay module are controlled by opto-isolators. Ok, that "might" be good .. But .. and here is the double Grrr ! part - the modules come with another LED for a visual indicator (in addition to the opto-isolator) .. So it adds up to be 50+ ma per input which needs to be sunk .. and the gutless PCF8474 can only sink 20ma :(
I thought about desodering, or grinding off the LEDs .. but the PCF8574 is still probably too weak to sink the necessary current for the opto-isolator .. Meh .. so I've got to add MORE COMPONENTS :(
8 x 2N2222 and 8 1K resistors
wired like this except up to a PCF8574 instead of an Arduino Uno
Update 2014.07.19
Raspi & I2C module both appear to be working. Yay !
Now it's time to install MRL - dropped the myrobotlab.jar - ran
java -jar myrobotlab.jar -update
it didn't work - but the prelog does :P
Here the raspi is downloading all the services
This is one of my current top 4 things to finish on the Borg Todo List.
MRL will be controlling my sprinklers (it has for years - but since the electric valves were outside, winter destroyed them). Since I need to replace the valves, it seemed like a good time to upgrade the hardware too.
Previously I used an Arduino controlling my own TIP120 transistor switches.
I found some big 5VDC coil relays on the internet for very cheap.
But they drove me NUTS ! .. Had to comb the internet for any documentation at all.. Finally a schematic which showed it supported electrical isolation with a phototransistor. Ok, I hooked it up, but did not care about the isolation but it always behaved very strangly ... sometime it worky .. sometime no.
Now Boss#1 (wife) came home from Japan trip and found no automated sprinklers. Oops.. ok so I had a closer look at the schematic and the printed board and realized that it HAS 2 GROUNDS !!!! even if you do jump together both sides of the 5VCC & JDVCC. After tying the grounds together it works solid.
Quick trip to the Home Despot .. and I put together the Uber Manifold for the sprinkler systems.
I'm putting this together from re-cycled parts - so I happened to have a super-beefy 5VDC regulator which should be plenty power for the raspi, I2C digital io board, & the 5V side of the relay module. Did not have the right molex connector, but nothing a quick solder can't fix.
The whole thing will be fed by a salvaged 21 VDC power supply. The valves are supposed to be 24V but I've seen them switch as low as 12V, so I think I'm good there.
Next will be to clip a micro usb connector and hook it up to the regulator - will be the power for raspi coming off the regulator.
PCF8574 - I2C Module $6 -