kiwistag
asked on
PHP query / monitor data from Telnet to MySQL
I'm building a series of weatherstations for some of our sites.
I'm using Arduinos with USB to Mikrotik routerboards not only for power but serial interfacing of the output.
I've created a telnet interface to read the virtual serial port and have the output post every 5 minutes or so from the Arduino.
So far the output from the telnet session shows:
I'm going to expand the sensors considerably at a later date but at this stage am wondering on the best way for PHP to open and monitor the telnet session and then post the output from the Arduino to MySQL for monitoring purposes. I hope to later pass the data per read to the likes of Weather Underground (since some sites already have weather cameras) or APRS/CWOP.
For the serial/telnet output I can change the formatting to suit. Maybe have it in a layer that is CSV.
Any ideas/input would be appreciated.
I'm using Arduinos with USB to Mikrotik routerboards not only for power but serial interfacing of the output.
I've created a telnet interface to read the virtual serial port and have the output post every 5 minutes or so from the Arduino.
So far the output from the telnet session shows:
Temp = 19.00 DegC
Humidity = 59.00%
SoilHumidity = 10%
Not Raining
I'm going to expand the sensors considerably at a later date but at this stage am wondering on the best way for PHP to open and monitor the telnet session and then post the output from the Arduino to MySQL for monitoring purposes. I hope to later pass the data per read to the likes of Weather Underground (since some sites already have weather cameras) or APRS/CWOP.
For the serial/telnet output I can change the formatting to suit. Maybe have it in a layer that is CSV.
Any ideas/input would be appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try using the Expect language, it's designed for just this purpose.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Telnet session - this is a bit of a misnomer in this context. A "telnet session" is just a socket connection on a particular port. You would not access a "telnet session" via PHP - you would create a socket connection to the IP and port you want to talk to.
ASKER
I haven't abandoned this question just yet. I've been looking at Arduino Yun Shields and even integrating to a Pi for ease of use and remote programming.
So far a Pi is cheaper than the Yun Shield and allows a lot more flexibility too.
So far a Pi is cheaper than the Yun Shield and allows a lot more flexibility too.
@kiwistag,
Do you still require assistance with this question? If so post back here otherwise please can you close the question.
JulianH
Do you still require assistance with this question? If so post back here otherwise please can you close the question.
JulianH
ASKER
Project has been put on hold until time allows. With the information given it will steer me in the right direction.
ASKER
Turns out the Arduino Ethernet shields and some extra Arduino libraries can do MySQL calls so we can push instead.