Cycling Champion generator control module useing BS2 detect 12v start\stop gen. batt. chargers
svparallax2017
Posts: 214
Is anyone good at writing code? Can anyone help me write the code for this? My device monitors 12volts from battery banks to activate 2 programmable timer relays. I need to ground out terminal 85 when the voltage is <12.3volts. The Arduino voltage sensors divide the voltage so the Parallax board can see it at 0 to 5 volts. The magic voltage number to activate the relay =< .06volts. The other way is to make the one output PIN "HIGH" to connect to a TIP31C transistor BUT the Parallax board only outputs 4.5volts. The transistor needs 5 volts to switch the relay.
Comments
. I don't know how to code the input PINS 15 and 8 from the Arduino voltage sensors to write the "IF THEN" condition to get to the ADDRESS output PIN 0 or "HIGH 0". 0 Pin outputs voltage to the automotive relay (terminal 85) that the programmable relays (terminal 30) are connected to.
The Parallax Home Work Board with the (16 pin?) BS2 . They sell "The Basic Stamp 2 Experiment Board" at Radio Shack.
Radio Shack is going to announce a new bankruptcy chapter soon if they haven't already. I got this BS2 board for $16.
All there products including the tiny stuff like "NPN Transistor 2N3904" is being liquidated now.
for us DIY people.
Yes, it's sad to loose such a close and convenient supplier. OTOH it does not take long to get used to the convenience of ordering on line and having it delivered. It may not be as fast as running to the nearest store but there is so much more available.
Is the section in bold the relay you want to activate, and does it come on a board with a diode?
There is no diode. Its just an (terminals 87,87a,30,85,86) relay. The coil is terminals 85 and 86.
I need a description or diagram of how your parts are connected. Here is a list of parts with my guess.
1 - The Arduino Voltage Sensor 0-25V
– Input comes from the battery pack and the output goes to the Voltage input of the EAZY VLC.
2 – EAZY VLC
- Input comes from the output of the Arduino Voltage Sensor 0-25V and the output relay goes to a pin on the Basic Stamp
3 - GERI FRM01
- ??
4 – Basic Stamp
- 2 inputs come from the EAZY VLC, and one output goes to a transistor that turns on #5, the relay.
5 - SONG CHUAN 896-1CH-D1 Coil:12VDC 40A/30A 14VDC C1012
- Output pin from the Basic Stamp drives a transistor connected to the relay coil.
2 IF THEN the voltage at the Basic Stamp is .06 volts (12.3volts) <<<<<<CONDITION
3 "LOW 0" pin this energizes the SONG relay <<<<<ADDRESS
4 When that relay IS activated the GERI and EAZY programmable relays turn on at same time
Sorry to make you wait Kwinn. I am new to forum and doing exercises from book 'What is a Micro Controller' with board
currently the "BiColorLed.bs2"
It is a strong enough ground to do light the LED. Why not the negative side of SONG relays coil???
A led only requires a few milliamps so the BS2 can do that directly. For components that need more current or higher voltages some form of driver is needed like the 2N3904 transistor you mentioned earlier.
The relay you mentioned earlier needs 12V for the coil. How much current does it need? If that is not specified you can measure the resistance of the coil with a multimeter and calculate the current needed.
Unfortunately I tried the 2N3904 it did not activate the relay. My "HIGH" commands only output 1 volt so I am going to try a different relay to activate the EAZY programmable timer.
As I mentioned in a prior post if you connected the relay coil to +12V and the BS2 you may have damaged the pin. Do not connect anything to the BS2 pins and then measure the voltage on the pin when you do a "HIGH 0" command. I will post a diagram of how the relay coil and transistor need to be connected to the BS2 when I get home.
Right now the code looks like this
' {$STAMP BS2}
' {$PBASIC 2.5}
'Autonomous generator control module '
'Detects voltage levels activates programmed relays to start electric start generator'
counter VAR Byte
FOR counter = 1 TO 9
DEBUG ? counter
HIGH 14
PAUSE 350
LOW 14
PAUSE 350
NEXT
DEBUG ? IN8
DEBUG ? IN15
IF (IN15=0) THEN
HIGH 0
HIGH 4 'Red
LOW 3
PAUSE 250
LOW 4 'Green
HIGH 3
PAUSE 250
HIGH 4 'RED
LOW 3
PAUSE 250
LOW 4 'GREEN
HIGH 3
PAUSE 250
HIGH 4 'Red
LOW 3
PAUSE 250
LOW 4 'Green
HIGH 3
PAUSE 250
HIGH 4 'RED
LOW 3
PAUSE 250
LOW 4 'GREEN
HIGH 3
PAUSE 250
LOW 4 ' Off
LOW 3
PAUSE 250
ELSEIF (IN8=0)THEN
HIGH 0
HIGH 4 'Red
LOW 3
PAUSE 250
LOW 4 'Green
HIGH 3
PAUSE 250
HIGH 4 'RED
LOW 3
PAUSE 250
LOW 4 'GREEN
HIGH 3
PAUSE 250
HIGH 4 'Red
LOW 3
PAUSE 250
LOW 4 'Green
HIGH 3
PAUSE 250
HIGH 4 'RED
LOW 3
PAUSE 250
LOW 4 'GREEN
HIGH 3
PAUSE 250
LOW 4 ' Off
LOW 3
PAUSE 250
ENDIF
DO
LOOP
The I/O pins on the BS2 can not measure an analog voltage, only a digital high or low so it would be either 1 or 0 respectively. With an input voltage of 2.46V it could be either value. To measure the analog voltage you need an ADC.
Can you explain the ultimate goal of this project?
The BS2 senses voltage or receives input from battery banks.
The BS2 outputs a command to start relay sequence to start a generator.
"IN15=0"
How do I get it to see a "0" when the Arduino voltage divider sensors see .06 volts on the sensors output side?
to turn on that generator.