This device was used to upgrade analog equipment thus It has been built for a very specific application, but one can easily change it or make it a part of a project where a solenoid valve needs to be controlled. I used Arduino uno as I had it avaiable, but it is not the best choice as it takes up a lot of space.
This device has three buttons:
- Reset.
- Set timer. Changes time interval.
- Cycle On/Off. Turns cycling on and off.
The solenoid stays on for 3 seconds. You may consider using an encoder if you want to be able to adjust the duration. Because my project required an airtight container, I added a temperature sensor TMP36 (I did not need a calibrated sensor) and a thermal fuse. The formula in the code calculates the temperature in Celsius.
If the temperature is 45 degrees Celsius or over a red LED will turn on.
The screen displays current temperature, On/Off time interval in minutes and shows whether cycling is On or Off. I used a mosfet IRF530, feel free to pick another one.
I used one power supply for the solenoid and the board, that is why I had to use a separate circuit to lower the voltge for the board.
I used step bit to drill holes in the enclouser for the buttons and external usb. Must have easy usb access in case you need to change code.
I let 'int i' to be default initialized inside of a function since it does not really affect the application, but it is not the right way, you should initialize it to any value othe then 0 or 1. I went a little bit heavy on a button debouncing because of the environment in which that device is used, you may want to change it if you have to.