RPI Cloud Server - Log Events to SQL Database on Pi - SOLVED

Pretty much as the topic title suggests. I can see the instructions on how to create your own local cloud server on the RPi. That looks fairly straight forward Can anyone point me in the direction of some help around how to extract the event variables to a SQL database stored on the Pi?

I need to create a self-contained app that doesn’t rely on the internet.

Many thanks

Here’s an example for storing data using a node.js server and MySQL. It was designed for the real cloud, but it may work on the local cloud as well. I never tested it with local cloud; I presume the publish and subscribe endpoints work, but I’m not positive.

Actually, I would do it this way, using Wi-Fi only instead of using the local cloud. This example uses a node.js server, a MySQL database, and can take data sent from Photons and add the data to the database. It doesn’t require an Internet or cloud connection at all.

1 Like

thanks for the suggestions - The second answer seems to require a wifi network ie. both devices connected to the same router? Is that right?

Another idea is to make the RPi in to a router which i’ve done before and have the photon connect to that network.

The particle cloud server for the RPi doesnt seem to work any more from the instructions i’ve followed. Seems like some dependencies have been updated and or moved so it just throws errors. So the own cloud option is out for me.

The other option I have is using bluetooth (as the devices are feet apart albeit too far for cables) so am looking at an Arduino with a bluetooth module attached.

Any ideas are welcome. Thanks for responding.

Just to note - where I am I can’t connect either device to a network of any description LAN/wireless etc.

You can use an external Wi-Fi access point that both the Raspberry Pi and the Photon(s) connect to. It doesn’t need to connect to the Internet, and some of them are really inexpensive. I use TP-LINK TL-WR702Ns in these applications and they’re about US$16 each.

Or you can put a USB Wi-Fi adapter in Raspberry Pi in AP mode and have it serve the Photons. It’s harder to set up, but it should work once you get it working.

Hmm all sounds very doable with the pi acting as a AP. Looking at your code. The .cpp how do get this in to the photon and connect it to the AP SSiD without a cloud connection? CLI?

Good news all. It works. Photon happily sending data to the rpi access point and storing the data in a SQL database. So no client WiFi or particle cloud server required. SQL information is then displayed in a browser through the rpi. Many thanks. Code above worked perfectly. Happy to help others with specifics should they have a similar request. Thank you Rickkas7.

For reference I used the second link: