Android on raspberry pi



dear friends welcome back! the summer is over and i am back with a newproject. today we are going to test the new raspberrypi 3 board, by building a simple but useful project. we are going to build a touch screen weatherstation.


Android on raspberry pi, let’s start. a few months back, the raspberry pi 3 boardwas released. it is a great new board because it now offerswifi and bluetooth connectivity out of the box!


it uses a quad core processor which operatesat 1.2ghz and it has 1gb of ram available. from the benchmarks i have seen, this boardis at least 3 times faster than the original raspberry pi. it can run linux and offers 40 gpio pins forour projects. the impressive thing is its price. it costs around 40$ and gearbest.com was kindenough to send me a sample unit in order to test it and build projects with it. you can find a link for it in the descriptionof the video. in order to test it, i built this weatherstation with it.


as you can see, i have connected a 5’ inchtouch display and a dht22 sensor and in the screen we can see live update of the temperatureand humidity. the temperature and the humidity values areupdated every two seconds. if i click anywhere on the screen, the applicationsquits so we can use the raspberry pi for other purposes. this project is a nice first project to buildwith a raspberry pi, because you will learn how write and run code on it, and you willlearn how to use the gpio pins of it. but let’s now see how to build this project. the parts needed in order to build this projectare these:


• a raspberry pi 3 or any other raspberrypi board • a dht22 temperature and humidity sensor• a 5” touch display • some wiresyou can find link for all the parts in the description of the video. now, let’s connect all the parts together. first we have to connect the dht22 sensor. we connect the pin with + symbol to gpio pin40 of the raspberry pi. although pin 40 is not connected to 3.3v wewill configure it to be high in the code later. we connect the ground pin of the sensor togpio pin 39.


lastly we connect the output pin of the sensorto digital pin 38. the next step is to attach the display. it is very easy. you can also watch a detailed tutorial i haveprepared about this display by clicking on the card here. that’s it, now we can power up the raspberrypi and load the code. now that the raspberry pi is ready to usedownload the code of the project from the link in the description of the video and placeit in a folder named weatherstation. along with the code you will find a file namedbackground.gif which is the background image


for our project. next we have to install a couple of libraries. first of all we have to download the dht22sensor library from adafruit. unzip the library on the desktop, open theconsole and type the following 2 commands. sudo apt-get updatesudo apt-get install build-essential python-dev next, run the commandscd desktop/adafruit_python_dht-master to navigate to the library folder and then install thelibrary with this command. sudo python setup.py installthat’s it. the dht library is ready to use.


the next step is to install an imaging library. type the following 2 commands and wait theinstallation procedure to complete. after that we are ready to use the code. navigate to the project folder with the command:cd desktop/weatherstation then just run the code with the command:sudo python weatherstation.py the program will run and after a few secondsthe temperature and the humidity readings will appear. you can exit the application by clicking anywhereon the screen if you have installed the drivers for the touch display.


let’s now take a quick look at the codeto see how it works. the code uses the tkinter graphical user interfacepackage. we have used it in the past as well and ihave prepared a video on that, you can check it out by clicking on the card here. watching that video will help you better understandwhat’s going on here. at first we declare all the libraries thatwe are going to use. next we define the gpio pin 40 as an outputand we set it to high in order to provide power to the dht22 sensor. next we create a full screen image backgroundby loading the image file from the weatherstation


folder. after this, we create two text labels forthe temperature and the humidity. with this command we bind the click on thescreen or the mouse click with the exit function which exits the application. with this command we call the function readsensorafter two seconds. note that the command is executed in a separatethread in order not to lock the user interface. the read sensor function calls itself everytwo seconds. it reads temperature and humidity from thesensor and updates the labels on the display. as you can see with a few lines of code, wecan build very impressive projects using the


raspberry pi 3 board. the fact that the board now offers wifi connectivityout of the box, makes things more interesting. we can improve this project by adding onlinedata logging to it, and weather forecast using openweathermap api for example. we can also use different background imagesdepending on the weather conditions and so on. i will work more on the project soon, so staytuned. i would love to hear your opinion about thisproject. how do you want to see it evolve?


please post your comments or ideas in thecomments section below. thanks! if this is your first time here, i would loveto have you subscribed. in this channel i post videos about diy projectsevery saturday. i love making things and i believe that anyonecan make things, anyone can become a maker. that’s why i created this channel, in orderto share my knowledge with the community and


Android on raspberry pi

learn from the community. i hope you will join us. until next saturday, watch, learn, build!


[ translating these subtitles? add your name here! ]


Android on raspberry pi Rating: 4.5 Diposkan Oleh: PaduWaras