How to see Arduino logs when Networking to serial
DashBarkHuss
Chicago
in OpenBCI_GUI
I'm sending data (simulated data at the moment) to my Arduino Uno R3 through the serial port using the OpenBCI GUI's Networking Widget
Networking Widget
Is there any way to see the Arduino logs to help me debug?
I have some Serial.println
s. But if I open the Serial Monitor in the Arduino program, it seems to interfere with OpenBCI.
Comments
Dash, hi.
Unfortunately, to use the Networking widget Serial output mode, the GUI needs to open the physical serial port on the laptop. And when it does this, it blocks it being open by the Arduino IDE Serial Monitor window. And vice versa, only one process can open the laptop serial port at a time.
A possible workaround would be for you to place a SECOND serial port device on the Arduino. Or a Wifi Shield acting as a virtual com port. Then tell the GUI to use that second COM port instead of the main serial port used by the IDE Serial Monitor.
https://www.google.com/search?q=arduino+serial+port+shield
https://www.google.com/search?q=arduino+wifi+shield
William
So some like this RS232/RS485 Shield for Arduino?
And use a USB to RS232 Adapter?
That's the general idea. But note you'll have to figure out how to tell your Arduino main loop to read from this serial port instead of the default. See link to sample source code below. Also I'm not clear if the transmit / receive pins are already swapped on the RS232. You will need an RS232 "gender changer" with switchable Rx/Tx swap; note both DB9's are female in above photos.
https://www.tinyosshop.com/arduino-rs232-rs485-shield
https://docs.arduino.cc/learn/built-in-libraries/software-serial [source code uses this .h file]
https://www.google.com/search?q=db9+gender+changer+with+tx+rx+switch
Something like this. You need male male and "null modem" which means TX RX are swapped.
https://www.amazon.com/Kentek-Adapter-Changer-Coupler-Crossover/dp/B07KVDXCHW
I'm not guaranteeing any of this will work. With RS232 you frequently just have to keep trying combinations until you find what is needed.
I found this FTDI breakout board that I already have.
src
Any idea if something like this work as a second serial port device?
The issue with the breakout board, is that you would have to wire the RS232 (DB9) connectors yourself.
Oh, so I couldn't just use a USB cable for this breakout board in the same way you can use a USB with the Arduino's built-in USB serial connection? You'd have to still connect the breakout board to an RS232 (DB9) cable?
The shield you mentioned:
https://www.tinyosshop.com/arduino-rs232-rs485-shield
https://docs.arduino.cc/learn/built-in-libraries/software-serial [source code uses this .h file]
Expects to connect via RS232 (DB9 connector), to the serial port. Your serial dongle ALSO is using RS232 DB9.
What Arduino do you have? Some Arduino's already have multiple serial ports. I think the 'easiest' solution is to just use the serial dongle with the shield. But there may be ways to do it without that extra hardware. But more complex wiring wise.
These are the serial ports existing on Arduino-made boards:
https://www.arduino.cc/reference/en/language/functions/communication/serial/
As you can see the Serial0 port is usually using pins 0 and 1, and cannot be used for your "2nd serial port", because it is already devoted to uploads and log messages. This table above lists 'hardware' serial ports that have timing support in the microcontroller. It is also possible to do "software serial" ports using other pins. So whatever Arduino you have, it is likely capable of software-serial. The shield you were looking at can do either software or hardware serial.
https://www.tinyosshop.com/arduino-rs232-rs485-shield [see source code file]
https://docs.arduino.cc/learn/built-in-libraries/software-serial [source code uses this .h file]
Note that when using software-serial approach, the bit rate / speed of the port may be limited, since the microcontroller needs to tightly control the software timing of sending or receiving the serial bit stream.
Assuming you find a way to do 2nd serial port pins on your existing Arduino, then yes, you could use your previously shown Sparkfun FTDI breakout board, to become the serial port on the computer side via the usb cable. Eliminating the need for both the serial port shield AND the dongle.
Then you would need to use 3 jumper cables (male-female) between the breakout and your Arduino serial port bits. Tx on one side goes to Rx on the other, and Rx on one side goes to Tx on the other. GND to GND. I think there is some isolation built into the FTDI chip, so these 3 connections are not causing any issues.
BE ABSOLUTELY sure that both breakout and your Arduino are set for the same voltage (3.3V). This should default to 3.3V if the jumper on the back of the breakout has not been altered.
@DashBarkHuss
I am the creator of the Arduino Focus example that I think you are working on. I am also updating this Instructable/Example at this very moment. Attached you will find a picture of my "Focus Fan" that uses an FTDI breakout cable attached to an Arduino Pro Mini. Before this, I used the standard USB cable plugged into an Arduino UNO (genuine).
The way I tested the Arduino code was by typing either 1 or 0 into the Arduino Serial Monitor, which is what I recommend you to do. The values from the GUI are guaranteed and confirmed in this chart https://docs.google.com/document/d/e/2PACX-1vR_4DXPTh1nuiOwWKwIZN3NkGP3kRwpP4Hu6fQmy3jRAOaydOuEI1jket6V4V6PG4yIG15H1N7oFfdV/pub.
If you have any further questions, don't hesitate to reach out here on the Forum and tag me.
Hope this helps,
RW
@retuitut I tried writing 1 and 0 in the serial monitor, but I don't think that worked: https://www.loom.com/share/79a2db2ad2824f08a37165a874ee8dbc
My mega isn't working. But in the meantime, I'm trying the software serial approach with an uno. This is what it showed with the EMG setting. This is what it showed with the Focus setting. Is this to be expected?