Solenoid Valve - LCD and Keypad Interface

I am new to the Arduino world and need some guidance with my project. I currently have figured out how to control a solenoid valve to make a specified number of drops at different intervals via USB and the arudino programming interface. My next goal is to figure out how I can incorporate a key pad and LCD to set the number of drops and the different delays between each drop. Is this feasible so that the Arduino is standalone and variable via a keypad and LCD. I appreciate any guidance.

Is this feasible so that the Arduino is standalone and variable via a keypad and LCD.

Feasible, yes. Easy, maybe or maybe not. Depends on your skill levels and tolerance for blocking.

If the program has a switch to trigger posting a menu, and you create a function that loops until some specific "Accept" key is pressed, and returns a value composed from the keys pressed, the project is relatively easy. If you need the Arduino to continue doing stuff while a new value is entered, it becomes a bit more complicated.

Experiment with what works for you and your process.

Here's how I see the program works.

The device is turned on.
Menu to set drops or run previous drop sequence.
If "Drop Set Up" is chosen then:
LCD asks, "How many Drops?"
User enters a number (Example: "3") and pushes a key to signal next question.
The Arduino asks for "Delay between drops 1 and 2?"
User enters a number in milliseconds (Example: "50") and pushes a key to signal next question.
The Arduino asks for "Delay between drops 2 and 3?"
User enters a number in milliseconds (Example: "50") and pushes a key to activate solenoid sequence.
After the third drop in the sequence the program ends and brings the user back to the menu.

If "Run previous drop sequence" is chosen. The program would run the previous drop sequence and return to main menu when finished.

I hope this makes things more clear.

Any extra help would be greatly appreciated.

I am also working on something similar. I am new to Arduino too, but so far I have been successful in programming it to run a pump and switch flow of different liquids using solenoid valves. Like Chris1290, my next step is to incorporate a keypad and display, and have a menu with the options to enter in different values for how long and at what speed the pump runs before switching of solenoid valves for each pumping step (i.e. the user would enter in a flow rate and volume to be pumped for each step). The Arduino doesn't need to be controlling anything else while waiting for user input.

Currently I am changing the volumes and flowrates by modifying the sketch and uploading it each time I want to change, but I would like it to be a "stand alone" device. I would also really appreciate any help on how to do the above, or even a link to something similar someone has done. Thanks.

hack and change the code i been using to suit your self i have shown the whole code here with a problem i have been happening im sure you can use it and take out what you dont need like the temperature stuff and change opt1 values to the values to what you want and change the menu names better suited to what you want and then make code for solinoid conrol i use the menu to change to values in the lcd keypad shield to control 2 relays for different temps but you can change the code in the loop for opt1 and opt2 for your timming.

its a start anyway the menu works for the lcd pad sheild, sorry im not very good at coding myself this is my first sketch.

http://arduino.cc/forum/index.php/topic,71157.0.htmlm

Something like this library?

Demo of the library sample code.

ok now im gutted, that library looks awesome
time for new sketch.

tsenior:
ok now im gutted, that library looks awesome
time for new sketch.

Alright. In case you are interested in getting the shield, visit my blog :wink: That would be a good way to support me to release updates.

I looked at your blog but i could not find the bigger lcd panel for sale just a picture, if you have the bigger one for sale i would happily buy some more gear :), dont you worry i checked out your stuff :slight_smile:

Here you go!

http://www.inmojo.com/store/liudr-arduino-and-physics-gadgets/item/phi-2-interactive-arduino-shield-2004/

6th most popular item on inmojo.com, right after the 16X2 version.

Don't worry, this is not an actual business. With how much effort I put getting parts, packing them and shipping them, supporting software, I don't think this will make money :wink: Just a hobby to keep arduino fans and myself happy.

I removed most of where to buy sections in my blog pages and replaced them by a single link, so hopefully this is a step towards more clarity:

great thanks, im sure you been asked a million times, are you going to release a lcd with buttons connected via 1 analog input to save pins, currently thats the type of sheild im running with the 5 buttons connected to A0, the code someone wrote that was posted above works well with no delays as my normal ardunio duemilanove will instantly run out of pins via each button needed own pin unless i start pissing about extending with 74HC595's to get more outputs, which for my first project i dont really want to, modifying the code to work for me was hard enough let alone more code for bit shifters :slight_smile:

I did get asked several times about analog keypads. I have thought about that but didn't make a design change. Someone else is already doing it :slight_smile:

Here is what I have as an independent LCD keypad panel on serial connection to arduino:

http://www.inmojo.com/store/liudr-arduino-and-physics-gadgets/item/serial-20x4-lcd-keypad-panel---phi-panel/

This not only reduces the usage of arduino pins from around 16 (LCD, 16 key pad, buzzer, LCD back light, 4 LED indicators) down to 2 pins (soft serial or hardware serial), but also integrates all I know about display formatting and key sensing plus phi_prompt library elements. It's an independent panel and has a microcontroller on board. You can set up a menu or number entry in less than 1 minute like this:

Serial.println(“Menu:”); // Display ” Menu” on line 1

Serial.println(“1.Display GPS info”); // Display option 1 on line 2

Serial.println(“2.Record GPS info”); // Display option 2 on line 3

 

while(1) {

  if (Serial.available()) {  // Make sure there is a key press

    char response=Serial.read(); // Read key press from phi-panel

    if (response==’1?) display_GPS(); // Display GPS info on LCD

    if (response==’2?) record_GPS(); // Record GPS info on SD card or EEPROM

    break; // Breaks out of the while (1) loop.

  }

}

Everything goes through serial. You can do serial.print and the panel will wrap lines and scroll if needed. A key press becomes a '1' or '2' from serial.read. No need for library or elaborate code to do key sensing and debouncing etc.

Details:

On this panel, I used shift registers to sense 16 keys and control 4 LED indicators, all with 5 arduino pins, much less than what typical 4x4 keypads would use alone, which is 8 pins, let alone they don't have LED's to indicate things. I intend to modify my phi-2 shield sometime so that it will be able to have more keys and LED indicators, only requiring less pins to operate.

that is very cunning :), also interested in your IR remote control light show kit it it easy to adjust the code for more hexshifters to control more, interested in using that kit to control my house lighting.

Thanks. I'm interested in making things easy so even beginners can use. But that doesn't mean I dumb things down. That panel has 30 page long manual. Experienced programmers will be able to make more use of the panel :slight_smile: The IR light show is an interesting project I did a while back :slight_smile:

man you sold out of the Serial 20X4 LCD keypad panel already?

If the keypad is only used for inputting a few numbers and selecting from sets of values (e.g. setup/run), you could use a rotary encoder instead. Place the LCD cursor on or just before the number you want to adjust, have the program adjust it when you turn the encoder (with min and max limits), and accept it and move on to the next question when you press the encoder.

Chris1290:
Any extra help would be greatly appreciated.

I assume this is for a high speed photography project?
I have already experimented with this idea, although using a picaxe (I have only just ordered my first arduino). This biggest problem I had (still have!) is not the soleniod timing, but regulating the water drops consistantly - I found it impossible to get two drops to fall at the correct time to get the desired effect (a single drop was no problem).
If this is not for a photography project then please ignore this post :roll_eyes:

Texy

dc42:
If the keypad is only used for inputting a few numbers and selecting from sets of values (e.g. setup/run), you could use a rotary encoder instead. Place the LCD cursor on or just before the number you want to adjust, have the program adjust it when you turn the encoder (with min and max limits), and accept it and move on to the next question when you press the the encoder.

If you want to run menus and interactive features say input password, I don't think a dial will be very effective, although my phi_prompt library allows operating anything with 1 button, the rest are on auto buttons, like old-school arcade game hall of fame :grin: :grin: :grin: