Sample Code for Connecting 2 Photons (Wifi Direct)

I’m trying to develop a way to communicate information from a Photon with a sensor to another Photon with a GSM Module for eventual transmission to my system. I have the latter figured out and the Photon/GSM is communicating with my server, though I haven’t found a good place to start for sending data from the originating (sensor) Photon to the GSM-connected Photon. Does anyone have sample code for this or know where I can find some? I’m relatively new to this.

As far as I know you will need a Wifi router between your two photons.
Did you think about using an Electron? It has GSM built in and can do the same things a Photon can do just without Wifi.

I have read that I’ll need a WiFi router as well but am hoping there is a way around this.

Maybe something like what is mentioned in this thread?

“the Broadcom BCM43362 chip which the Photon is based on does support Wi-Fi Direct mode (will require firmware changes) that will allow you to connect between two photons , however that will be point-to-point type communication, not really mesh type.”

I am actually using the Electron right now for the GSM module, but this is connected via breadboard to the receiving Photon. I cannot find any documentation or comment from Particle that it is indeed possible to have 2 photons connect without a WiFi router. All I can find is comments that say it is possible via softAP/Wifi Direct as of last September (intended release date). Do you know of any threads that confirm or deny this?

Hi @Goose

You have asked this same question in several threads now–let’s try to stick to one thread please.

The hardware is capable of WiFi Direct and you can see that in SoftAP setup mode where the Photon acts as an access point for setup. The problem is that the firmware is not done for WiFi direct mode.

I know it is on the team’s radar for a future release, but they are currently working on stability. It is an open-source project and if you can contribute, that is always great too!

1 Like

I have asked it in several threads because I need a concrete confirmation as quickly as possible (as it is extremely time-sensitive), preferably from someone in Particle’s engineering department so that I can tell my team.

I’m trying to get a confirmation as to whether or not it is currently available functionality. If the hardware can support it and I can change the firmware to allow it, where can I contribute or see what is currently available? If it isn’t possible at this time, that is fine, I just need an answer.

EDIT: @bko Do you have a more current source post than this one about the possible release date?

Last I read, it was slated for completion last September.

Give the “open source” link at the top right a try: :wink:

OK, @Goose if you need an official response I will ping @BDub or @jvanier into this thread.

To the best of my knowledge, no work has been done on WiFi Direct, but it is possible that something has happened quietly.

If you want to play with using SoftAP mode, that is in a working state for setting up Photon WiFi credentials using some extra software over and above the shipping firmware. You would be limited to HTTP connections as I understand it.

Thank you very much. An official response would be immensely appreciated.

Using with an electron might work as well. It seems as though the WiFi is only required to communicate between the devices, for which Bluetooth could be a viable substitute?
If you do still need wifi for other purposes, consider combining the Electron with the bluz node, and a redbear duo. Should give you cellular, wifi and bluetooth, all working within the particle ecosystem :smile:

If you could elaborate on what exactly is is you’re trying to do, we might be able to offer more precise advice?

Thank you @Moors7.

My team is actually trying to move away from bluetooth as our application is deployed in environments with heavy RF interference. Using BLE has posed a significant challenge and been a source of frustration for our clients and it is why we were so interested in Particle. Unfortunately I can’t say too much about what we’re doing other than what I originally posted to protect our IP but I really appreciate your help despite the general use case.

@Goose, BLE and WiFi operate in the same frequency range. Have you confirmed that WiFi will be more reliable in those environments?


The Photon/P0/P1 hardware does support WiFi Direct. The core functionality is exposed via the Broadcom WICED platform. Since (I assume), Particle are basing their firmware on that platform, you should be able to use this functionality. ( although it might no be trivial… ).

Particle guys - would he be able to grab the header files from the WICED platform, and link with that ?
( or, let me ask it in a different way )
have the WICED platform symbols have been obfuscated/removed from the binary objects ?

btw - the fact that you cannot expose the WICED library is a real shame. ( on Broadcomm, that it… )


1 Like

@peekay123, we have not confirmed this as of yet but are in the process of rapid prototyping to verify. We are interested in WiFi over BLE for a variety of other reasons including, but not limited to, range, bandwidth, and internet connectivity.

Thanks! If my team were to attempt to do this, what would you recommend as the best place to start?

I think that the right place to start is here, asking questions. And it looks like you’re doing quite well with that…
After that, I would go back to the h/w specs, verifying what’s possible, what’s hard to do, and what would not be a good idea for your solution.

I would review the Broadcomm WICED API, just to figure out if the functionality there is what you’re missing. For me the STA+AP used to be the issue. ( but it might already be available on the Photon by now ).

Also, be aware of C.H.I.P.; it doesn’t have as many i/o capabilities as the Photon, but it’s much more versatile.
( it’s a Linux machine… ) It’s also much cheaper ( 9$ computer ! )

Note that most of the P0/P1/Photon BOM comes from Broadcom/USI and not Particle, so even if you’ll mass-manufacture that, you won’t be able to lower your BOM for this part by much.
( in other words, Particle gives you already quite a good deal compared to their cost… )


This is fantastic advice. Thank you very much. We are definitely interested in C.H.I.P but can’t afford to wait until they are actively in production.

@Goose I’m not sure what wifi over BLE means. Have you looked at the bluz (

I was referring to using Wi-Fi instead of BLE when I said Wi-Fi over BLE. I have heard of though! @Moors7 told me about it and it looks like it could be promising