I have a greenhouse which uses and STM32h7 processor to control the temperature. The controller has an ethernet port using LwIP. This port connects to a wireless bridge into my home LAN.
I use a c# system tray application to get the data from the LAN an put it into an MySQL db. The ethernet interface uses raw data over TCP/IP. I have used B4J apps in the past for this type of interface, but decided to try c# just for fun.
The MySQL greenhouse db was generated manually using queries and looks like:
The tbl_process_analog gets updated by the controller every minute and the status data every ten minutes or on a change in a state.
There is a circular buffer for each of these which can store about two days of data before overwriting. On failed transmissions (timeout or client error report) rollback of the data output pointers occurs so data isn't lost.
Times are all stores as unix seconds Universal Coordinated Time (UTC) with the time stamping done from the embedded systems real time clock. This clock is set and then updated by the network time.
I also made a small B4A app to view the data, preset statistics and a couple of graphs.
It's not very complicated, but it works well and wasn't very hard todo.
I hope someone finds it useful
Additional:
There were a couple of bugs in the previous version. jRDC and the Android App I have fixed these and I have also included two queries in a text file called CreateTableQueries. If you copy each of these into an sql script you can easily create the tables in work bench or in the case of sqLite, sqLite studio. I also drew a block diagram of the entire system so you can more easily understand the comms/connection setup.
I use a c# system tray application to get the data from the LAN an put it into an MySQL db. The ethernet interface uses raw data over TCP/IP. I have used B4J apps in the past for this type of interface, but decided to try c# just for fun.
The MySQL greenhouse db was generated manually using queries and looks like:
The tbl_process_analog gets updated by the controller every minute and the status data every ten minutes or on a change in a state.
There is a circular buffer for each of these which can store about two days of data before overwriting. On failed transmissions (timeout or client error report) rollback of the data output pointers occurs so data isn't lost.
Times are all stores as unix seconds Universal Coordinated Time (UTC) with the time stamping done from the embedded systems real time clock. This clock is set and then updated by the network time.
I also made a small B4A app to view the data, preset statistics and a couple of graphs.
It's not very complicated, but it works well and wasn't very hard todo.
I hope someone finds it useful
Additional:
There were a couple of bugs in the previous version. jRDC and the Android App I have fixed these and I have also included two queries in a text file called CreateTableQueries. If you copy each of these into an sql script you can easily create the tables in work bench or in the case of sqLite, sqLite studio. I also drew a block diagram of the entire system so you can more easily understand the comms/connection setup.
Attachments
Last edited: