first, watch the working video and see how it works.
This is my "solenoid based FLUID Dispenser (alcohol sanitizer dispenser)" which is actually the second iteration of this overkill sanitizer
you can check UTSOURCE.net, they deal in all kinds of electronics components like for example Attiny85 which I'm using in this project and many more components. do check them out.
now, how to make this big fluid dispenser?
I have followed two approaches in order to create this,
first was, I made an inner tank to hold the fluid and then cover it up with 130mm Cylinder PVC Pipe.
this method does work, its ideal for holding like a cup full of sanitizer.
my requirement was to hold at least 1 liters of sanitizer so I used this container, (its alternative is hard to find so I made a 3D design of the whole structure, you can just print it, roughly take around 20 hours I think)
so I added the solenoid valve to the container in a crude manner (just use silicone adhesive and hot-glue gun to stop leakage and 60% of work was done)
Now just fill the tank and apply 24V to the solenoid, you have now an electric fluid dispenser which doesn't have a decent looking body but its functional and can be used into many different projects.
anyways, so I used this Microcontroller to control the Solenoid valve.
I made this PCB which consists of an MP2314 IC which is a buck converter IC which converts 6-36V DC to constant 5V and 2A, and then this circuit power the Attiny with 5V and there's a MOSFET as switch setup which is controlled by Attiny and load is connected to the input of this PCB (6-36V). so basically, if I have a 12V battery and a 12V motor, I can control that motor with Attiny without deep frying the microcontroller with 12V.
I hooked up everything according to scheme and power everything up after uploading code to Attiny MCU.
how? by using "Arduino as ICSP"
watch this video for that
first, I used an IR Proximity Sensor to sense the hands of the user
it worked BUT
IR Proximity Sensor has a big flaw, its not very precise and works with a short distance. my setup worked but I had to bring my hand too close in order to get sensed by IR which then trigger the Solenoid valve.
it was very weak, so I Swap the IR sensor with an ULTRASONIC Sensor.
The ultrasonic sensor works better than the proximity sensor, also I can increase or decrease the distance and I can do it more precisely.
you basically need to print this (the bottom part is not really needed).
the 24V or 12V solenoid valves may have different nozzle dia but you can add reducers or use super glue or hot glue to seal them.
SV that I used have dia of 8mm so just put a rubber tube on top of it and connect it to the container and used lots of hot glue to seal everything.
just get creative with this sealing thing.