Offline
Newbie
Karma: 0
Posts: 43
|
 |
« on: November 23, 2012, 12:05:14 am » |
On my in-progress robot (more like a go kart but it has robotics components) We're planning to build a Formula-1 style steering wheel with a display and a few buttons. My plan is to use a Parallax Serial 4x20 LCD with i think 2-3 of these little buttons http://www.amazon.com/gp/product/B004RXKWI6/ref=ox_sc_act_title_3?ie=UTF8&smid=A2E0IHQCUI9LTK). Now on to the part I need help with. We want to have the robot print data like speed of the wheels, battery voltage, temperature inside the hardware case (motor controllers and the arduino) and probably the cooling fan RPMs, and current disable/enable state for drive. So, since i know nothing about code and have been using off the shelf stuff so far, what would a basic program to have the buttons scroll up/down on the LCD data look like?
|
|
|
|
« Last Edit: November 24, 2012, 12:03:42 am by BurtonCustomX »
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5920
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #1 on: November 24, 2012, 01:41:15 am » |
Not an easy job. My phi_prompt library will NOT work with serial displays but someone has made modifications to make it work. Take a look to see if this is what you want.: http://liudr.wordpress.com/libraries/phi_prompt/
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 43
|
 |
« Reply #2 on: November 24, 2012, 11:26:02 pm » |
So could I use that library to make the screen scroll through data with the buttons?
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5920
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #3 on: November 25, 2012, 12:02:53 am » |
So could I use that library to make the screen scroll through data with the buttons?
Do you have a parallel LCD? If you do, yes you can. If you only have your serial LCD, you need some modification.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 43
|
 |
« Reply #4 on: November 25, 2012, 12:38:29 pm » |
Nah I don't. I just have my 4x20 serial LCD. So could I just get one of those phi-2 shields? I really don't know much about programming
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5920
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #5 on: November 25, 2012, 02:04:36 pm » |
Phi-2 shield still needs some programming. If you use your serial lcd, you need very little programming to print to it, although you need quite a bit programming when you add buttons. I tnd to say phi-panel backpacks are the easiest product to do interactions, but again that is my product. I am curious to know what you want with buttons, in details, so I can decide whether phi-panels are a match.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 43
|
 |
« Reply #6 on: November 25, 2012, 05:55:33 pm » |
Well basically, the robot will grab data such as wheel speed (measured by encoders), intake and outtake fan RPMs, current battery voltage, cabin temperature (hardware cabin), robot disable/enable state, and throttle input percentage, and publish it to the LCD. However this is few more things than can be displayed on a 4x20 LCD. The buttons would enable the LCD to scroll through this list both up and down, along with controlling wether the back light is on (for LCD) So i would need 3 buttons in total
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5920
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #7 on: November 27, 2012, 12:47:39 pm » |
OK, so you want a long message, which keeps up updating every once in a while to display on a screen and you want to use 2 buttons to scroll the message? Maybe in the future you want some buttons to make some changes to the setting? I can see how part one (long message) is done with a serial display and buttons. Here is the version that will work with my phi-panels: unsigned long last_update=0; const int update_period=5000; const int max_screen_location=3; //You have 3 extra lines that need to scroll since you have 7 pieces of info.
int wheel_speed; int intake_RPM; int outtake_RPM; int battery_voltage; int cabin_temperature; int enable_disable_state; int throttle_input_percentage; char formatting[][20]={{"Wheel Speed:%4d"},{},{},{},{},{},{}}; // Need to finish
int screen_location=0; void setup() { Serial.begin(19200); }
void loop() { if (millis()-last_update>update_period) { last_update=millis(); Measure_everything(); Display_info(); } if (Serial.available()) { byte in_byte=Serial.read(); switch (in_byte) { case '1': if (screen_location<max_screen_location) { screen_location++; Display_info(); } break; case '2': if (screen_location>0) { screen_location--; Display_info(); } break; } }
Void Measure_everything() { //Please fill this up with code that does all measurements. }
void Display_info() { for (byte i=screen_location; i<screen_location+4; i++) { //Render one line at a time and send to screen } }
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 43
|
 |
« Reply #8 on: November 27, 2012, 02:00:15 pm » |
Well I kinda want it to update constantly so the speed can be used as a speedometer. So Phi-panel would work for this project?
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5920
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #9 on: November 27, 2012, 02:03:07 pm » |
Well I kinda want it to update constantly so the speed can be used as a speedometer. So Phi-panel would work for this project?
The display can't be updated too quickly. If you do 5 updates a second, that is the limit to human eyes to read numbers. You can keep measuring and only update display 5 times a second. Yes, phi-panel can do that.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 43
|
 |
« Reply #10 on: November 27, 2012, 02:27:44 pm » |
5 times a second sounds good. And is the code above good for basic screen display with scrolling? Cause I was thinking about adding a button to disable/enable the robot and for turning backlight on/off
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5920
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #11 on: November 27, 2012, 04:18:31 pm » |
5 times a second sounds good. And is the code above good for basic screen display with scrolling? Cause I was thinking about adding a button to disable/enable the robot and for turning backlight on/off
The above code is a framework. You need to fill some details in. I could help if you do your part first. Turning back light on and off is easy too. Just some more code.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 43
|
 |
« Reply #12 on: November 27, 2012, 04:49:52 pm » |
Alright. So we can assign all these features to buttons on the phi panel? Or could I use the serial LCD with some buttons for the same task?
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5920
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #13 on: November 27, 2012, 11:33:29 pm » |
Alright. So we can assign all these features to buttons on the phi panel? Or could I use the serial LCD with some buttons for the same task?
Right, you can assign any phi-panel key to any tasks. In that sense, you may assign several buttons to do the same job, or even one button to do different jobs under different situations.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 43
|
 |
« Reply #14 on: November 27, 2012, 11:35:36 pm » |
So is there any assembly (like soldering) involved with a phi panel? Cause i don't know how to solder. And where do i buy one? if i cant use my lcd and some buttons 
|
|
|
|
|
Logged
|
|
|
|
|
|