A Serial debugging monitor for newbies

I had a hard time using a serial monitor with the online IDE. Here is a method that worked for me:

This method requires two USB ports, a USB to serial converter, and a terminal program. Here are some resources:

USB to serial (3.3V or switchable 3.3/5.0V)
sparkfun $15
adafruit $15
ebay

Some free terminal programs for windows:
Bray Terminal
Realterm

NOTE: Check that FTDI serial converter outputs 3.3V (and not 5V) before connecting.
Wiring must have Gnd to Gnd, Tx to Rx as shown.
Terminal app and device baud rates must match.
Your code must use Serial1.begin instead of Serial.begin.
If no output, check device manager to be sure you are using the correct com ports.

If anyone has a prettier diagram, please let me know.
Enjoy !

2 Likes

Of what kind were your problems with Serial?
What OS are you on?
Do you mean Particle Dev (instead of online IDE)? I don’t know of a serial monitor in Particle Build :confused:

I was using Win7 with the online IDE, not the Dev IDE. I was getting output from Serial about 10-20% of the time. It seemed that the terminal app and photon were “fighting over” control of the com port, so I turned to the scheme above and it works fine.

I am a photon newbie, and one of the several photon examples that I was trying to use was this: https://www.hackster.io/oswalpalash/sms-theft-notification-b98d0c?ref=part&ref_id=9500&offset=64. It uses Serial.begin(9600);

I have not used the Dev IDE, but if there is, in fact, a difference in using Serial between the online and Dev IDEs, the differences should be made known (for the benefit of newbies like me) and the examples and tutorials should make note of which IDE should be used.

Are there any other methods for debugging when using the online IDE?

I see. No, there is no difference in the behaviour of the Serial object regarding used dev env.
I was just puzzled about what Particle Build (online or web IDE) would have to do with serial communication over USB.
Build does not take any control of the USB COMs, so I’m still not sure where your problem comes from.

The reason why I thought of Particle Dev is that it has an inbuilt USB Serial Monitor which used to work quite well, even being able to get around the following issue.

One common issue with Windows and a lot of COM drivers including Particles is that you need to close an open COM (on the Windows side) if a device restarts, otherwise the device can’t “reclaim” that still open COM when it comes back.
I’m using PuTTY and have set it to auto-close the connection whenever it looses contact to the USB device and never had issues with this.

Another thing that sometimes happens is that other USB devices (e.g. mouse) start playing up if you’re hammering a USB COM from the Photon too fast with binary data.

About the speed of USB COM, you can always set it to 115200 since the timing is set by the USB protocol and not via the baudrate setting. So unless you’re talking 115200 or more between Photon and FTDI you might loose some time not going the direct way.


BTW: I assume you’ve downloaded and installed the Particle COM drivers.

1 Like