Go Down

Topic: 4D systems ViSi-Genie uLCD-32PTU-AR screen displaying DHT22 temperature data (Read 1 time) previous topic - next topic

Gustermaximus

Hello again, all you amazing programmers who always make my brain stop hurting! I have read too many different articles and seen too many different "examples" of how to integrate an Arduino Uno with various sensors, but none of them seem to have a simple explanation or example of how to code the Arduino part to simply display the temperature reading of a sensor to the thermometer gauge on the LCD. Designing the interface on the LCD using the VisiGenie is simple enough, but I don't know how to get "insideTempSensor" to display on "Thermometer0" OR "int setTemp" to be adjustable by "Trackbar0."

Would someone be kind enough to give me a stupid simple example code of how to show a temperature reading from a DHT22  (or any other temperature sensor for that matter.. I don't think the sensor makes a difference, does it?) sensor on a thermometer gauge via the arduino code itself? I am still a newbie to Arduino and the 4D displays so any and all help here would be greatly appreciated!

I would also like to add the "Set Temp" option to my project, as I've seen there is an option for it on the pre-made thermometer gauge, to control the on/off control of a relay. ANY AND ALL HELP IS WANTED AND GREATLY APPRECIATED!!!  :)


Caltoa

I guess not.
I can only find the example that they give with the library.

Gustermaximus

I would think this shouldn't be that hard to understand, but I just need a good walkthrough on the Arduino side of the programming in order to figure out how I send data from one thing to another.


In the sample code it shows how to communicate with a slider. I need to know how to print a temperature from an input on the arduino to on a thermometer (ie. Thermometer0) or on a digit display (ie. leddigits0). lol I'm begging for an example code of this... :~
Code: [Select]


if(Event.reportObject.cmd == GENIE_REPORT_EVENT)
  {
    if (Event.reportObject.object == GENIE_OBJ_SLIDER)                // If the Reported Message was from a Slider
    {
      if (Event.reportObject.index == 0)                              // If Slider0
      {
        slider_val = (Event.reportObject.data_msb << 8) + Event.reportObject.data_lsb;  // Slider0 data into the slider_val setpoint 
        genieWriteObject(GENIE_OBJ_LED_DIGITS, 0x00, slider_val);     // Write Slider0 value to to LED Digits 0
      }
    }
  }

Graynomad

Doesn't something like

Code: [Select]
genieWriteObject(GENIE_OBJ_LED_DIGITS, 0x00, slider_val);

do the trick? Where 0x00 is the index of the LED object.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Gustermaximus

I'm not so much in need of understanding how to get information talking between the board and the screen for a slider as I am in need of a temperature sensor displaying info on the screen. I can use example code for the slider to make my set points and what not, but I really just need to see sensor outputs. I am just using this thermostat-like project as a test program to get familiar with the screen integration for various future projects.

robtillaart

for a DHT22 example - http://playground.arduino.cc/Main/DHTLib -
you only need to do the display part
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Graynomad

So if you know how to write to the display this is a thread about reading a DHT22 isn't it? In which case why the heading and example VisiGenie code?

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

WanaGo

Its pretty easy really...

Have you had a look at the 4D Systems forum, and the area for Arduino?
There are quite a few examples in there where people have asked questions and examples have been provided promptly.
Also have you looked at the App Notes they provide? There are ones specific to the Arduino talking to ViSi-Genie.

http://www.4dsystems.com.au/appnotes/

Check out 4D-AN-P4017 , 4D-AN-P4018, and 4D-AN-P4019 for a start...

Then wonder over here and have a look. Couple of really good examples for people getting started in there:
http://4d.websitetoolbox.com/?forum=272259

WanaGo

Gustermaximus

Just for clarification, I have had success in using multiple different kinds of sensors and displaying them on a sainsmart 16x2 lcd shield. READING the sensor on the arduino is easy enough. I need to know what the command process is to send the sensor data TO the ViSiGenie lcd gauges.

This is how I send sensor data to the sainsmart LCD. Set the cursor and the "lcd.print" command allows me to print whatever I want. How do I send data to the 4D Systems LCD like this?
Code: [Select]
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("TEMP       ");
    lcd.print(temp);
    lcd.print("  ");
    lcd.print((char)223); // degree symbol


I have been searching on the 4D systems forums and through the example files but it seems like everything is only halfway explained or not at all. I'm still very new to the programming world and the way I learn is by seeing the code in working form and then see it work accordingly on the hardware. I'm just looking for an Arduino example code  :~

WanaGo

The sainsmart LCD and a 4D Systems display are quite a different animal.

If all you want to do is for the Arduino to tell the display to display text, then the solution is very simple. It however depends what you want to do. Do you want to only program the Arduino and the display is just a slave which you dont load an application on itself, or do you want to be able to program both and do more complex graphics to display your data.

If you simply want to display "TEMP 100" etc, then you may be best to use Serial, not ViSi-Genie.
However it is also easily done with ViSi-Genie, but you just need to program the base program into the display, set up the objects you want to animate with data etc, and then send the data in the appropriate format using the library they provide.

Do you want the data to just be text on the screen, or do you want it like 7 segment displays, or do you want it like a gauge, or a graph or what... lots of options, all very easy.

What examples are you referring to which are only half explained? Maybe I can help.

Have you looked at the App Notes they provide?

You are using the uLCD-32PTU right, in the -AR pack (Arduino pack)?
Do you have the Arduino Adaptor with lots of headers/jumpers on it (Version 2) or do you have the more simple Version 1 Arduino Adaptor shield?

I can create you an example if you want.

WanaGo

Made you a simple demo.

2 zips, 1 Arduino code, the other ViSi-Genie code which you load into the display using Workshop4.

http://www.taktik.co.nz/Arduino/TempDemo_ArduinoGenie.zip
http://www.taktik.co.nz/Arduino/TempDemo.zip

I assume you know how to program the display using WS4.
Requires a microSD card in the display.



Get the 4D Systems library for Arduino and ViSi-Genie from Github if you don't have it already:
https://github.com/4dsystems/ViSi-Genie-Arduino-Library

Hope that helps
WanaGo

Gustermaximus

Thank you SO much @WanaGo! That was EXACTLY what I was looking for. You have brought sanity back into my life  XD This is an excellent example and I know I can't be the only one who has been looking for one like this!

I can't wait to plug in all my code parts to the arduino code and test it out! Thank you to all contributors! All comments were helpful  :)

Go Up