Simplest way to Raspberry control led on Photon

I have search hundreds of website, I watched many videos, but I cannot understand how to make raspberry pi talk to Photon, where it could read a sensors or turn led on or off, etc…)

I managed to use the Particle app to turn the d7 led on/off.

I cannot find a way to make the raspberry pi talk to Photon.
Some websites say I need to use the protocol i2c. but to use it a need to connect the RPI to the Photon with wire. which doesn’t make any sense.

Please give me a light…

Do you need the two devices to talk to eachother directly, or can they use the Internet?

The simplest method I can think of is to publish a Function to the Particle Cloud, and call that function from the Raspberry Pi using a REST call.

Have a read of this:

another way is to use the serial port.


Well for what its worth, I was able to log data from a couple of photons on a PI.

I set up the photons, with each one publishing several strings of data.

Then I wrote a python script, which used a libary called Requests. This Request Libary, allows curl commands to poll the particle cloud, obtain the data that the photons published. From there you can do what you want with the data, such and log it to a local text file. There is nothing to say that the PI could not actually post curl commands, which could control photons from the PI. The photons would need to be set up to ‘subscribe’.

So it should be possible. But the key trick is to learn about curl commands, which can directly control the photons, from a computers command line, and then you can script the commands within a python script to automate the process, but the key bridge is to use Requests, to faciltate the curl commands within Pyton.


Okay, Thank you guys.
I am reading the materials you recommended

The only thing I wish to do is a smart house, where via a local ip I connect to a webpage that is in the raspberry pi (server), and it will turn on/off light (there is a photon connect on it- client), check if door as close/open (there is another photon connect on it- client).

So there is no need of make Raspberry Pi Master, Photon I2C Slave" stuff.

another way that comes to mind is to install the Particle Agent on your Rasp Pi and have it talk to your photons via publish/subscribe.

The Agent is discontinued, but it works for me on a couple of Rasp Pis I have.
You can find one example here.



Oh, then why not just create a TCP/IP socket client/sever on your devices. Eliminate the cloud stuff altogether and keep your coms local. If you ever decide to slap more sensors in the home for the Pi to monitor you can start getting into broadcasting for all to hear and respond.

But, it’s worth noting, You can also create a websever on the Photon as well, just saying incase you didn’t know.

Have you installed the Particle CLI on your RasPi yet? To me, that would be the easiest way to just do some Proof-of-Concept testing. You can monitor cloud-exposed variables, call functions, publish and subscribe events… It’s a great debugging/testing tool.

When you’re ready to build your home control web page, you’ll probably want to look at the Particle JavaScript API. Just try to be careful not to expose your login info or secret token to the open internet.