Can someone help me with a sketch for the arduino to monitor an existing switched 12v+ signal
& output separate momentary on & off pulses, whilst consuming minimal to no power in the off state.
Also would like to use the same arduino for a 12v low battery cut out EG.
Using Analog 1 to monitor 12v battery level through some sort of voltage divider?
Or buy cheap voltage monitor with separate LEDs for each voltage?
Then join an optocoupler between each LED & empty Analog inputs?
When battery is above at or below a set level the Digital outputs 1&2 act as per above
(separate momentary on & off pulses)
EG2. Sketch for the arduino
Analog 0 is held high by 10k resistor to 5v+ (switched 12v+ in the off state).
When Analog 0 is held Low via relay contacts to ground (switched 12v+ in the on state),
this causes Digital 3 to Pulse for 500 milliseconds.
When the relay contacts to ground are disconnected (switched 12v+ in the off state),
this causes Digital 4 to Pulse for 500 milliseconds.
And Analog 0 is again held high by 10k resistor to 5v+.
Purpose.
In the attached image You can see a momentary SPDT ON-OFF-ON switch,
I would like to replace this switch with a circuit triggered from a switched 12v+ input,
that will output a control signal for the (BRN) & (ORG) wires.
As well as include a low voltage cutout.
Skill level.
I think I can handle the hardware side.(manliy thanks to other posts I’ve read)
The code side, I have built a few arduino projects follwing tutorials & adjusted the code to my needs.
But never somthing from scratch.
Thanks for your quick reply
At a glance that code seems a great place to start if not exactly what I need.
I should have been more specific in my question, I was looking for any help/guidance as to the whole project.
I did however make a mistake with the pins & their uses.
list of the pins & their uses:
Analog 0 = Input from Battery to be monitored
Digital 5 = Normally held High, then pull Low when 12v+ is applied
Digital 4 = Pulsed Output to apply 12v+ to Brown wire
Digital 3 = Pulsed Output to apply 12v+ to Orange wire
When digital 5 goes low, digital 4 pulses high for 500 milliseconds
When digital 5 returns high, digital 3 pulses high for 500 milliseconds
Analog 0 constantly monitors 12v battery level through voltage divider
When battery is above at or below a set level the Digital outputs 3&4 act as per above
(separate momentary on & off pulses)
I’ve attached my idea of how I hope it will work???
Unsure though, would D4 (5v1 Zener Diode) act fine as over voltage protection?
I found this 12v lead acid battery cutoff sketch but how would I go about incorporating this into the code you’ve posted?