2017/05/01

Log and retrieve data using Orange Pi

Recently I bought an Orange Pi PC which is a small single-board computer. It is similar to Raspberry Pi 3 but costs about one third of the price. To testing it's long term functionality and reliability for future purposes I built a setup where I use it as a data logger in the following Internet of Things project.


The plan was to send wirelessly some sort of real time data to the Pi (aka Server), which needs to be immediately stored in database. Secondly, the timestamped data should be retrieved anytime using a browser.

As data source I used the DS18B20 digital temperature sensor which I connected to a Wifi module - NodeMCU - based on the well known ESP8266 Wifi enabled microcontroller. To send the temperature values I wrote an application in the Arduino environment of ESP8266, where I managed to read the sensor in every minute and post the value simply over TCP connection. So at now only the text formated payload goes above the TCP layer.


The measured temperature is being displayed locally at the station on a cheap Nextion Human Machine Interface.


Later on when the whole setup worked I got the idea to get in the business an another temperature source, so I put the breadboard below with sensor and wifi in another room.


This time I wanted to test for this purpose the cheapest ESP8266 module - the ESP-01. It worked.

On the server side first I installed Armbian on the Orange Pi which is a Linux distribution for ARM boards. After that next Apache and PHP for webserver to display the temperature values in browser later; WiringOP to interact with peripheral (LED and character display) connected directly to Pi; MySQL database to store the timestamp-temperature datapairs; Node-RED to redirect the incoming data to the database and show something on the display.



The operating mechanism of the Pi can be divided into two parts: log data into database; retrieve and show temperature in webbrowser.

The first part was implemented in Node-RED, which is a graphical programming interface based on javascript.


The incoming text formated temperature data from the two Wifi stations appears here on the left side as TCP-inputs (grey nodes). Upper stands for the Wifi station #1, lower the #2. When there is incoming data on these inputs, the first LED (LED string) on the breakout breadboard of Pi will flash once - using LedBlinker and LedBlinker EXEC nodes. Using a function node the data will be modified/edited to a valid INSERT MySQL query. The two separate datatables for temperature values are accessed via melesolDB named nodes (orange).

I made a tiny C app compiled with GCC running in the background using node-daemon (light orange node on the right side named /root/GccProjects/TestProjectI2c/TestProjectI2c2). This node executes the bash command written inside, and constantly takes input on the left side, which serves as STDIN for my app. String coming here inside will be identified: LCD background LED on/off, temp1/temp2 data, exit command. The STDOUT of my app is redirected to debug window on the right (green node).

Retrieving temperature values are implemented with PHP scripts and Google Line Chart javascript code for drawing charts. Here the PHP code basicaly reads the value pairs from both datatable of last 24h, and feeds them to chart.

The result is shown below as it can be seen in a browser:



For now that's all what this setup does. Actually it can be expanded with more sensors, but at now I just want to test the system in a long term period.

41 comments:

  1. I have a basic electronics course this semester which includes circuits ad stuff. This blog was really helpful for me you explained everything so clearly. Thaks a lot

    ReplyDelete
  2. I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy. spur gears

    ReplyDelete
  3. I am jovial you take pride in what you write. It makes you stand way out from many other writers that can not push high-quality content like you. compact tractors

    ReplyDelete
  4. Wow, What an Outstanding post. I found this too much informatics. It is what I was seeking for. I would like to recommend you that please keep sharing such type of info.If possible, Thanks. goedkope rolstoel

    ReplyDelete
  5. We were sufficiently fortunate to discover an Epson 1280 printer on eBay for about a large portion of the expense else where. this guide

    ReplyDelete
  6. I really like your writing style, great information, thankyou for posting. 토토사이트

    ReplyDelete
  7. i am always looking for some free stuffs over the internet. there are also some companies which gives free samples. 토토사이트

    ReplyDelete
  8. You have done a great job on this article. It’s very readable and highly intelligent. You have even managed to make it understandable and easy to read. You have some real writing talent. Thank you. 토토사이트

    ReplyDelete
  9. This is the type of information I’ve long been trying to find. Thank you for writing this information. 릴게임

    ReplyDelete
  10. Cool stuff you have got and you keep update all of us. 안전놀이터

    ReplyDelete
  11. Great post, you have pointed out some fantastic points , I likewise think this s a very wonderful website. buy youtube views

    ReplyDelete
  12. Merely a smiling visitant here to share the love (:, btw outstanding style. pii-email

    ReplyDelete
  13. I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website. 먹튀검증

    ReplyDelete
  14. Good post but I was wondering if you could write a litte more on this subject? I’d be very thankful if you could elaborate a little bit further. Appreciate it! สล็อตออนไลน์

    ReplyDelete
  15. Great articles and great layout. Your blog post deserves all of the positive feedback it’s been getting. 먹튀검증

    ReplyDelete
  16. Cool stuff you have got and you keep update all of us. crocs on sale

    ReplyDelete
  17. Liposuction is possible in almost any area of the body. Many of our patients opt to target more than one area of the body during their liposuction procedure because we offer discounts for multiple target areas. hop over to this website

    ReplyDelete
  18. It is truly a well-researched content and excellent wording. I got so engaged in this material that I couldn’t wait reading. I am impressed with your work and skill. Thanks. 대전마사지

    ReplyDelete
  19. I think this is an informative post and it is very beneficial and knowledgeable. Therefore, I would like to thank you for the endeavors that you have made in writing this article. All the content is absolutely well-researched. Thanks... 바둑이게임

    ReplyDelete
  20. Pretty nice post. I just stumbled upon your weblog and wanted to say that I have really enjoyed browsing your blog posts. After all I’ll be subscribing to your feed and I hope you write again soon! https://www.abercrombieand-fitch.com.co/

    ReplyDelete
  21. That is the excellent mindset, nonetheless is just not help to make every sence whatsoever preaching about that mather. Virtually any method many thanks in addition to i had endeavor to promote your own article in to delicius nevertheless it is apparently a dilemma using your information sites can you please recheck the idea. thanks once more. www.digitalanalog.in

    ReplyDelete
  22. What a thrilling post. It is extremely chock-full of useful information. Thanks for such a great info. 먹튀검증

    ReplyDelete
  23. Thanks for the blog filled with so many information. Stopping by your blog helped me to get what I was looking for. Now my task has become as easy as ABC. start a credit card processing business

    ReplyDelete
  24. I got too much interesting stuff on your blog. I guess I am not the only one having all the enjoyment here! Keep up the good work. Blissy pillow case reviews

    ReplyDelete
  25. You understand your projects stand out of the crowd. There is something unique about them. It seems to me all of them are brilliant. North American Bancard Agent Program

    ReplyDelete
  26. I’ve been surfing online more than three hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. In my opinion, if all webmasters and bloggers made good content as you did, the web will be a lot more useful than ever before. new internet device

    ReplyDelete
  27. This is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: Dentitox pro review

    ReplyDelete
  28. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. winnerslot

    ReplyDelete
  29. You communicate electronically for the most part and do not often have a need for high-quality printed documents. renting impresoras

    ReplyDelete
  30. very interesting post.this is my first time visit here.i found so mmany interesting stuff in your blog especially its discussion..thanks for the post! buy cialis 40mg in

    ReplyDelete
  31. Thank you for such a well written article. It’s full of insightful information and entertaining descriptions. Your point of view is the best among many. detectives infidelidades

    ReplyDelete
  32. Thank you very much for writing such an interesting article on this topic. This has really made me think and I hope to read more. Golden revive plus

    ReplyDelete
  33. Recently, I have commenced a blog the info you give on this site has encouraged and benefited me hugely. Thanks for all of your time & work. golden revive plus reviews

    ReplyDelete
  34. Thank you very much for writing such an interesting article on this topic. 메이저놀이터

    ReplyDelete
  35. I got too much interesting stuff on your blog. I guess I am not the only one having all the enjoyment here! Keep up the good work. 먹튀폴리스

    ReplyDelete
  36. Benefit from high precision, speed, and versatility with this best fiber laser engraver from OMTech. The adjustable pulse width and frequency help you to create colorful designs on black etchings, stainless steel, and anodized aluminum. Optics Trends

    ReplyDelete
  37. This comment has been removed by the author.

    ReplyDelete
  38. SFP modules are used to convert electrical signals to optical signals, making them a best buy for seamless data transmission. SFP Transceiver

    ReplyDelete