Need help getting my project over some bumps in the road, any help appreciated.
4 - E18-D80NK avoidance sensors (not in use yet)
4 - DC latching solenoids (2 irritrol, 2 Orbit)
2 - L298N Motor control boards
1 - 12 volt battery
Standalone battery powered box shaped object with water nozzles on 4 sides that will spray water in two different modes, random and motion sensor driven.
I realize this would be much easier if i ran 24 v valves on AC power but the whole point of this is to be stand alone and safe from higher AC voltage, after all it is for dogs to play in!
The DC latching solenoid valves require a pulse of 9-30 volts DC to operate so i decided on a H-bridge ssr circuit and why not use a prebuilt board ie. L298N boards.
I was having a a problem testing with valves attached so i’m going back to running with UNO attached only to make sure the coding runs correctly. I’m trying to tackle the random mode first before starting with all the input sensors.
- My code seems pretty straight forward but i can’t figure why its not running correctly, after powering on i run a quick 5 second pause for someone to turn on the water if they haven’t already then it just waits for someone to push one of the buttons to start a mode, random mode in this case, once pressed i assign time stamp to each valve and proceed to turn each valve on just to check on the next cycle if the duration of the valve has been met and turn off. My problem starts after i enter random mode and assign the time stamps it doesn’t do anything after that, it’s also repeating valve 2 for some reason, i threw in some serial monitoring to try and debug and will attach for review. Can anyone help with this?
15:55:55.584 -> Close valves function 15:55:56.710 -> Valve 1 turned off 15:55:56.850 -> Valve 2 turned off 15:55:56.943 -> Valve 2 turned off 15:55:57.037 -> Valve 3 turned off 15:55:57.130 -> Valve 4 turned off 15:56:17.518 -> Random mode selected 15:56:17.518 -> 02807 15:56:17.611 -> Valve 1 turned on 15:56:17.704 -> Valve 2 turned on 15:56:17.750 -> 15249 15:56:17.797 -> Valve 2 turned on 15:56:17.844 -> 24073 15:56:17.890 -> Valve 3 turned on 15:56:18.030 -> Valve 4 turned on 15:56:18.030 -> 39658 15:56:47.571 -> Mode timeout 15:56:47.571 -> Close valves function 15:56:48.699 -> Valve 1 turned off 15:56:48.793 -> Valve 2 turned off 15:56:48.887 -> Valve 2 turned off 15:56:49.028 -> Valve 3 turned off 15:56:49.120 -> Valve 4 turned off
Project code is attached
code_7202020.txt (8.65 KB)