Photon Test Breakout Board

Presently I just have them both powered by a usb cable, but you are correct If I use a PCB board I should use only one power source. On second thought for one of the serial connections I need the master to start before the slave which will be difficult if they are both powered together. I guess the reset button can achieve the same results.

Found this post

Looks like I will change it to 4.7 K ohm. Thanks @ScruffR

That may explain my problems with SPI. I really don’t want to switch off AUTOMATIC SYSTEM_MODE(). I have several SPI programs to test from Arduino’s and Raspberry Pi’s, sure wish someone had already got the SPI Master and Slave working on a Photon.

@avtolstoy or @mdma either of you want to add your two cents. I am trying to make some very simple: photon to photon SPI slave and master sketches. Not finding much examples so I have started my own.

I just want to send one byte from the slave to the master and one byte from the master to the slave as simply as possible. For the easiest code do you have to use onSelect and onTranserFinished as the DOCS example shows just below this link?

Since there is no Master example code I sort of found / changed this sketch

void setup ()
Particle.publish(“started”, “master”, 60, PRIVATE);
digitalWrite(SS, HIGH); // ensure SS stays high for now

// Slow down the master a bit

} // end of setup

void loop ()
char c;
// enable Slave Select
digitalWrite(SS, LOW);

// send test string
for (const char * p = “Hello, world!\n” ; c = *p; p++)
SPI.transfer ©;

// disable Slave Select
digitalWrite(SS, HIGH);

Particle.publish("Master Sent", String("Hello World"), 60, PRIVATE);
delay (5000);  // 5 seconds delay 

} // end of loop

any suggestions?

P.S. Presently SPISettings only compiles if I include Arduino.h whereas (Note the extra underscore before SPI)

__SPISettings settings(4*MHZ, MSBFIRST, SPI_MODE0);

compiles fine on its own.

Looks like something to do with

Now unsuccessfully trying:

As a master.ino

__SPISettings settings(4*MHZ, MSBFIRST, SPI_MODE0);

void setup ()

Particle.publish("started", "master", 60, PRIVATE);

digitalWrite(SS, HIGH);  // ensure SS stays high for now


void loop ()
char c;

digitalWrite(SS, LOW);     // enable Slave Select     

c = 'A';


digitalWrite(SS, HIGH);  // disable Slave Select
Particle.publish("Master Sent", String("A"), 60, PRIVATE);
delay (5000);  // 5 seconds delay 


And as a slave.ino

byte val;
String myIncoming ;
bool myGotData = false;
__SPISettings settings(4*MHZ, MSBFIRST, SPI_MODE0);

void setup() {

Particle.publish("SPI slave", "Started", 60, PRIVATE);
SPI.begin(SPI_MODE_SLAVE, A2);  // slave select on PIN A2    


void myOnSS(uint8_t state) {
if (state){
myGotData = true;
digitalWrite(A2, LOW);

    myIncoming = (char)SPI.transfer(val);
    digitalWrite(A2, HIGH);

} else { myGotData = false; }


void loop() {

if (myGotData){
    Particle.publish("SPI received bytes="+String(SPI.available()), myIncoming, 60, PRIVATE);
    myGotData = false;


Still having no luck. @rickkas7 do I have to manually set all pins to the correct inputs and outputs like some SPI Arduino sketches?

This has some good info

I was unable to get a single byte SPI.transfer© to work for a SPI slave. The example in this post does 8 byte transfers, but you can simply make the data buffer smaller and it will transfer fewer bytes.


Thanks Rick. Very happy. Got my SPI both master and slave working really well.

I posted my code at

1 Like

Looks like my serial testing board is working. Now I just have to learn Eagle software and make a PCB for both Photon PIN testing and Photon Serial testing. How hard can that be! :slight_smile:

Here is an image of the PIN testing breadboard one of my students made:

And here is an image of the horrible looking serial test breadboard I just made.

Which actually should look like this

The console output looks like this where the Master is on top and the Slave is below

View the code at my github at

or view these shared IDE files

Photon-Alone.ino (PIN Testing)

Photon-Master.ino (uART, I2C, SPI Testing)

Photon-Slave.ino (uART, I2C, SPI Testing)

Now I just need some broken Photon’s that actually still have working Wifi. This is actually a bit of a problem since most of my 11 broken Photon’s don’t load Wifi :unamused: . No mater how many times I tell the students not to hook a non-micro servo up to the Photon, every few weeks some creative student gives it a try. :rage:

Can’t blame all my dead Photons on the kids, I have released my fair share of magic smoke.

1 Like