(This is an adaptation/update from the original article written in the Particle Community forums.)
Here's how to get a Photon talking via serial to an Arduino using a logic level converter (I actually used one from eBay, but it works the same). The goal of this little test is to see if I could write from the Photon to the Arduino and listen for any serial data that the Arduino might generate. It's pretty simple and straightforward. Since my test Arduino is an Uno, I'm limited to SoftwareSerial, so I had to scale down the baud rate. I will eventually tap the Photon into an Arduino Mega which has multiple hardware serial ports *. The code is below the fancy graphics.
* Update! I have tested communicating from a Photon <--> Arduino Mega this way, and it does work! My test scenario was actually using a RAMPS 1.4 board (3D printer control board) and used hardware serial on both sides. It worked (mostly) great! The one caveat I discovered is that I think something has to be listening to serial communications on the other side of the Arduino Mega or a print can stall. My theory is that it is waiting for something on the other end to read in or receive that serial communication or buffers will not be cleared in a timely fashion in the Marlin firmware. I have no hard proof of this theory other than it worked well with something listening and would pause for several seconds at a time in mid-print when something wasn't listening. When I disabled the additional serial output in the Marlin firmware, things started flowing normally again.
Comments