Hey guys, I was wondering the compatibility for M4 boards to serially communicate through UART like on a traditional Arduino Uno. (Eg. you connect pin 0 and pin 1, rx and tx respectively) or is it something completely different.
I am currently working on a fiber optic program with Gravity: UART fiber transceivers and I was able to initiate serial communication through connecting the Rx and Tx cables to the respective pins on Arduino Uno V3s. Does the Metro Express M4 also allow this type of communication; if so what are the wirings.
I am relatively new to arduinos in general, help would be greatly appreciated.
Question regarding UART communication on Metro Express M4
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- maomaothegreat
- Posts: 5
- Joined: Wed Jan 15, 2025 2:02 am
- maomaothegreat
- Posts: 5
- Joined: Wed Jan 15, 2025 2:02 am
Re: Question regarding UART communication on Metro Express M4
I forgot to mention, I am using pinouts (10, 11) (Rx, Tx) on the arduino unos...and I am not sure if that offers anything else apart from using normal 0,1
- adafruit_support_carter
- Posts: 31358
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Question regarding UART communication on Metro Express M4
In general, it should work. However, there are a couple of things to be aware of.
Logic Voltage Level - The UNO is 5V logic. The Metro M4 is 3.3V logic. So you'll want to determine what the logic level requirements are for the device being connected (Gravity UART fiber transceiver?). If it requires 5V, then some form of logic level shifting will be needed to interface with the Metro.
Hardware vs. Software Serial - Either should nominally work. But hardware serial is preferred if available. And software serial is not supported on all platforms/pins. If you are using pins 10 and 11 on the UNO, then you are probably using software serial. That's a common approach for the UNO since the hardware serial pins on 0 and 1 are shared with the serial monitor. On the Metro M4, the hardware serial pins on 0 and 1 are *not* shared with the serial monitor, so could be used.
If you can figure out the logic level, the rest should just be a matter of using the correct pins and updating software.
Logic Voltage Level - The UNO is 5V logic. The Metro M4 is 3.3V logic. So you'll want to determine what the logic level requirements are for the device being connected (Gravity UART fiber transceiver?). If it requires 5V, then some form of logic level shifting will be needed to interface with the Metro.
Hardware vs. Software Serial - Either should nominally work. But hardware serial is preferred if available. And software serial is not supported on all platforms/pins. If you are using pins 10 and 11 on the UNO, then you are probably using software serial. That's a common approach for the UNO since the hardware serial pins on 0 and 1 are shared with the serial monitor. On the Metro M4, the hardware serial pins on 0 and 1 are *not* shared with the serial monitor, so could be used.
If you can figure out the logic level, the rest should just be a matter of using the correct pins and updating software.
- maomaothegreat
- Posts: 5
- Joined: Wed Jan 15, 2025 2:02 am
Re: Question regarding UART communication on Metro Express M4
Thank you!
I do have a quick follow up question however.
If I am using the MLX 90640 thermal camera which uses I2C will I have to manually write code that processes that into UART or is it automatically converted within the board.
Also, are there any open source guides on visualization of the thermal data onto a laptop display after it has been sent across the fiber. Some basic information would help a lot.
I do have a quick follow up question however.
If I am using the MLX 90640 thermal camera which uses I2C will I have to manually write code that processes that into UART or is it automatically converted within the board.
Also, are there any open source guides on visualization of the thermal data onto a laptop display after it has been sent across the fiber. Some basic information would help a lot.
- adafruit_support_carter
- Posts: 31358
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Question regarding UART communication on Metro Express M4
Can you link to a product page or more info on what the Gravity UART fiber transceiver is?
It sounds like it's something that can send data over fiber. But the device itself interfaces with a host controller via UART. If so, then yes, you'll need to write code that deals with reading the MLX90640 via I2C and then sends the data over UART to the transceiver. Which then sends the data via fiber. There's no standard for that.
There's a Python example here that uses PIL to create an image:
https://github.com/adafruit/Adafruit_Ci ... 640_pil.py
and this one uses pygame:
https://github.com/adafruit/Adafruit_Ci ... camtest.py
They both expect the MLX90640 to be directly connected. But you can use them as a general reference.
It sounds like it's something that can send data over fiber. But the device itself interfaces with a host controller via UART. If so, then yes, you'll need to write code that deals with reading the MLX90640 via I2C and then sends the data over UART to the transceiver. Which then sends the data via fiber. There's no standard for that.
There's a Python example here that uses PIL to create an image:
https://github.com/adafruit/Adafruit_Ci ... 640_pil.py
and this one uses pygame:
https://github.com/adafruit/Adafruit_Ci ... camtest.py
They both expect the MLX90640 to be directly connected. But you can use them as a general reference.
- maomaothegreat
- Posts: 5
- Joined: Wed Jan 15, 2025 2:02 am
Re: Question regarding UART communication on Metro Express M4
https://www.dfrobot.com/product-2588.ht ... lcn2zLS4iB
Thank you. I will look into the code for converting I2C to UART. I greatly appreciate your help!
Thank you. I will look into the code for converting I2C to UART. I greatly appreciate your help!
- adafruit_support_carter
- Posts: 31358
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Question regarding UART communication on Metro Express M4
It looks like that device works at 3.3V. So can power at 3.3V and interface the TX/RX pins directly to the Metro M4.
They have a diagram that shows that, with power saying "To 3.3V or 5V". You'll want 3.3V when using the Metro M4. You can uses the 3.3V pin on Metro itself to power the Gravity xcvr.
They have a diagram that shows that, with power saying "To 3.3V or 5V". You'll want 3.3V when using the Metro M4. You can uses the 3.3V pin on Metro itself to power the Gravity xcvr.
- maomaothegreat
- Posts: 5
- Joined: Wed Jan 15, 2025 2:02 am
Re: Question regarding UART communication on Metro Express M4
Thank you so much for the help!
Please be positive and constructive with your questions and comments.