Pico W writing into MySQL db?

Hi Jon

I am currently trying a Pico W as a weather station. It is taking a reading every minute on the minute. The readings are date and time (from the inbuilt RTC), temperature (from PiicoDev TMP117), pressure and humidity (from PiicoDev BME280). Unlike others have not had any difficulty with the PiicoDev sensors.

It sends readings to my external webserver which writes to its SQL database.

To get the readings to the server I am using urequests.get() viz

import urequests
r = urequests.get(url = 'https://www.myserver.com/iot.php?date='+date+'&time='+time+'&temp='+tempC+'&humidity='+humidity+'&pressure='+pressure)

The traps are the data must be in text format and there must be no blanks in the url.

The iot.php file uses PHP to receive the data as _GET['date'] _GET[‘temp’] etc. PHP writes the data into an SQL database.

I do not use HomeAssistant. Since I have my own webserver and with the data in an SQL database I have constructed my own. While web pages are normally static I use AJAX to keep the page continously up to date.

So to answer your question the Pico W can definitely store data in an external SQL database. Let me know if you need any help.

5 Likes