Internet of Things: My first experience with Galileo 2 (part 6)
Today it’s my last post about Galileo board for beginners. So I decided to test some features, which I avoided for some time due to soldering requirements. I have never used soldering iron before but I have a weather shield and a LCD panel, which don’t have already prepared pins.
For example, in order to operate, the weather shield requires four different “male to female” pin headers
In case of my LCD 1602 panel, it’s better to use something like this:
So, it’s time to visit a shop in order to buy some stuff for soldering. Finally, I spent around 30 Canadian dollars to buy the following:
There is the cheapest soldering iron, solder and some stuff for clearing iron itself.
Finally, I started to assemble the following device:
This device uses Weather board in order to measure temperature, pressure and humidity. In order to show collected data, I used LCD panel.
Of course, soldering requires some patience and frankly speaking, I didn’t have faith in the result and I was too surprised then it started to work.
So in order to create the device I used Weather shield. As I told before, I don’t like shields very much but in some cases shields help you to create something without special knowledge and very fast. You need just put your shield on your board and you should not think about circuits, voltage and anything else. At the same time, shields contains pins, which extends board’s pins and you may use them in usual way.
In case of LCD panel it’s not so easy. You need to know how to connect the panel to the board. So, you need review a datasheet for your panel. My panel has the following pins:
· VSS – pin that connects to ground
· VDD – pin that connects to 5V power supply
· V0 – pin that allow to change contrast of LCD
· RS – a special pin that controls where in memory you are writing data to;
· R/W – allows to select read/write modes;
· E – an enable pin;
· D0-D7 – pins for reading and writing data
· A and K – control the LED backlight
Review the datasheet more careful I found that I need connect my LCD to the board in the following way:
In order to connect V0 pin you may use potentiometer or resistor to control contrast but I decided to avoid one more component in my schema.
So, once you connected all pins properly you may start work with code. It’s not easy because you should understand right sequence of commands and prepare some functions there. But in many cases you can find already prepared libraries for your sensors and shields. In case of LCD and the weather shield you can find all needed files in Internet. There is a library for LCD and there is a library for humidity sensors and pressure sensor. You need to add all .cpp and .h files in your project and you are ready to create some code.
Thanks to our libraries, we just need to create objects of our sensors and panels and start listening data (begin method). After that we will use loop method in order to get the latest data and show it on LCD. You can use the following code:
int _tmain(int argc, _TCHAR* argv)
//configure LCD to use selected pins
lcd =new LiquidCrystal(4, 5, 6, 7, 8, 9);
//16 symbols and 2 rows
// Configure the sensor
float pressure = myPressure.readPressure();
Log(L"Pressure(Pa): %lf\n", pressure);
float altitude = myPressure.readAltitudeFt();
Log(L"altitude(Ft): %lf\n", altitude);
float temperature = myPressure.readTemp();
Log(L"Temperature(C): %lf\n", temperature);
float humidity = myHumidity.readHumidity();
Log(L"Humidity(f): %lf\n\n", humidity);
That’s all for today. As I told before, it’s my last post for beginners but I am going to continue to write posts about IoT. Next time I will describe how to integrate Galileo and Raspberry Pi boards together.