@ Dyslexicbloke
First off, thanks for the reply.
Now...
You are probably better using a logic level Fet, or even a standard n-channel and totem pole driver, as opposed to a Darlington BJT.
So it's a no to the ULN203A. The TIP120 is a better option? Sorry if this is a stupid question, I'm still new to all of this and struggling to keep up with all the tech jargon.
- The pressure and viscosity of the liquid will alter the flow rate even if the solenoid operation is consistent.
To be accurate you need some form of positive displacement device, even an optic on a bar works this way.
The metering container fills when the optic is not depressed and then completely emptys when it is.
You can only ever get 1 shot assuming that the optic was full to start with. There is control feedback in the system, the operator, who visually checks that the optic is full before starting the sequence.
vending machines use positive displacement pumps running at a known speed or rotating cups and screews to do the same thing, the ones that don't regularly over-fill or under-fill containers or put in the wrong amount of sugar or milk.
It was quite amusing how quickly you caught on to what I was trying to achieve. Well done.
I have seen the systems you describe, but they involve a lot more on the manufacturing side.
I've seen the "optics" that pre-fill before dispensement, and have actually taken one appart,
but like I said, it involves a whole lot more on the fabrication side.
So basically, I will have to build in some sort of double checking system to determine an accurate volume to dispense...
- If you leave your finger on the button for the whole dispense time then a second dispense cycle will start as soon as the first one finishes.
To address this you need to look for edges that is a transition from low to high, a positive or rising edge, or high to low, a negative or falling edge.
When you see an edge, your button is n longer in the state that it was, you act.
You can do this in the loop, it doesn't have to be an interrupt or anything complex.
However this brings its own problems that need to be handled ... see 3.
This is/was an initial concern, but I was hoping that the loop would handle this in some way or another.
Could you maybe elaborate more on this?
- You need to de-bounce the switches ...
Mechanical switches are almost never clean, they bounce when pressed or released, turning on and off rapidly for a short transitional period between open and closed.
If the glass was in place and the dispense switch was released after the delay was done you would be very likely to see a high on the digital read long enough to trigger a second cycle.
I am busy looking into the debounce situation. this was also brought up by PaulS and CrossRoads. I don't see this to be a big obstacle.
BUT, will debouncing the switches also sort out the situation where the botton is kept in? Or will this need to be approached on the coding side?
The button I intend to use is a "momentary button" if that makes any sense...
Thanks for the great feedback!