Rpi3 GrovePi+ Serial Issue

While setting up my Rpi3 + GrovePi+ setup for serial communication, I have enabled UART and disabled the console, and I am testing by connecting the RX pin on the GrovePi’s GPIO header to the TX pin next to it. When I connect to it using screen or minicom at 19200 bd, I am getting a jumble of garbage characters. The expected output should be an exact echo of the input characters. This also happens when I do the same loopback using a connector connected to the RPISER port on the GrovePi.

When I test with a serial device (for example, the RockBlock Mk2 I am trying to attach) I get similar results.

When I remove the GrovePi hat, and create the loopback between the RX and TX pins on the base Rpi3, everything works fine.

Are you using Raspbian for Robots? What operating system are you using?

Hi, i have the same problem, What is the solution that you found?


Hi @jjurado,

Can you share the details of the sensors that you have tried with GrovePi, the operating system(Raspbian for Robots or stock Raspbian) that you are using and also post a picture of your setup having the sensors connected to GrovePi.


This could possibly be related to the issue that on Rpi3, there’s only one real HW uart and it’s by default attached to the BLE module (/dev/ttyAMA0). To support the GPIO UART they hooked up a new miniuart and it is terrible, having issues including setting baud rate based on CPU speed (which is probably why it’s breaking EXCEPT if you loop it back directly)

On recent raspbian releases, /dev/serial0 by default uses the janky uart, /dev/ttyS0. But if this is the issue try disabling bluetooth and swapping the real HW uart over to the GPIO pins using a device tree overlay – instructions here should work: http://www.briandorey.com/post/Raspberry-Pi-3-UART-Boot-Overlay-Part-Two

You can’t do the equivalent using UEFI/ACPI on Win10 IoT (yet?), I asked on MSDN here: https://social.msdn.microsoft.com/Forums/en-US/f4df0601-4dc5-4130-a808-414ac6095e87/use-hw-uart-for-rpi-uart-disableswap-bt-to-miniuart?forum=WindowsIoT

Hi @jjurado,

Yes, nimish is right about the overlays. If you are using the Raspbian for robots image from Dexter then you can use the Advanced communication option from the desktop to easily turn on the UART.

Please let us know if this helps,

Thanks Shoban, i have replied you in other post. Here is the link:


We are using DIETPI and i know nothings about Advanced communication. The
code appears in this post.


Hi @jjurado,

You can try giving a shot to the instructions given in this page to have the serial communication working. Sadly, we cannot support a lot with DIETPI as we have not used it.I would recommend you to use our Raspbian for Robots image which we have built for our products. You can either download our Raspbian for Robots image and install it following the instructions given here or you can buy a SD card with our image installed from here .



do you belive that i cant get data from cozir CO2 sensor because of I am using DIETPI? When I connect this sensor through Raspberry Pi 2 (model B) there isn’t any problem however, with GROVEPI+ it doesn’t work. Today, I have connected this sensor using serial port of GrovePi but I am getting trash again.



The code that I am using and the error that I am getting, there are in this link:

Hi @jjurado,
Sorry for the troubles that you are having with the GrovePi.

If the code works on the Raspberry Pi, I am not really sure why it is not working on the GrovePi.

Can you paste the output that you get when it works correctly. Can you also specify the baud rate by default in the program. Can you also follow these tutorials and make sure if serial message logging is disabled on the Pi.

The code that I am using is:

import serial
import time
ser = serial.Serial("/dev/ttyAMA0",9600)
print "Serial Connected!"
ser.write("K 2\r\n")
while True:
    resp = ser.read(10)
    resp = resp[:8]
    print ""
    print ""
    fltCo2 = float(resp[2:])
    print "Co2 = " + str(fltCo2)

This code works fine when I connect directly to GPIO of Raspberry. However, I get trash when I use through GROVEPI. Also I have connected this sensor through Rpiser port of GrovePi and again the same problem. The baud rate is 9600 and the output when it works correctly is:

Co2 = 10.0
Co2 = 9.0

The sensor that I am using is: http://www.co2meter.com/products/cozir-5-100-co2-sensor. I have cheked that message logginh is disabled. If it wasn’t by this way i couldn’t read through raspberry directly.

Additional information:

  • Raspberry Pi 2 Model B
  • Grovepi+
  • DietPi

Thanks you very much.


I am not really sure why you are getting trash values with the GrovePi connected. Ther Serial port is not connected to anything which can send junk values on the GrovePi. Do you have access to a logic analyzer which might help with the debugging.

Another thing that you can try is to use minicom to read the raw data from the CO2 sensor without the GrovePi and then connect the GrovePi and check if you can see any bad packets in the Serial stream. Follow the Using minicom on the UART section here.

Dear Karan, you helped me a lot and I thank you

but at this point we are stucked to implement x2 Cozir CO2 sensors to make them work through the grovepi’s GPIOs, althought it is working through the GPIO when is connected directly (without the grovepi)

it would be nice if you could experiment by your own with a Cozir sensor, if you dont have, can we send you one?

thank you

Hi Annlee, sorry to hear about this. There is a level conversion chip on the two serial lines coming out of the Raspberry Pi, and I’m afraid this might be pulling the pins in a certain way that’s obstructing data from your sensor. Your best bet may be to try to confirm this with a logic analyzer; if that’s what’s happening there’s not a lot that can be changed about the board other than removing this ic; that would render the GrovePi+ board not so useful though.

thanks JohnC

since the grovePi makes useless the rpiB2+'s GPIO, we are thinking in 2 options:

1º using x2 USB adapter to connect each to a CO2 sensor


2º usinga rpiA just to connect the x2 CO2 sensors, and then somehow send the data from rpiA to rpiB+ (dont know how yet)

or do you really think it is impossible to make work the GPIO for the x2 CO2 sensors? I still want to send you a Cozir Sensor to anyone from the support team if you want

Hi @annlee,
I think the best option might be connect the CO2 sensor with a USB cable and I think the sensor comes with a USB cable too which should make it easier for you to use it.

I know this is old but is the level shifting problem still with us? I’m seeing the same behaviour(garbled characters) when I loopback the RPISER connector on my GRovePI+. If so how can I use any of the UART connectors on the GrovePI+ to connect to UART devices?

Hi @steve.hamblett,
Could you send us more details to support@modrobotics.com? I’m not sure where this issue was left off and I’d like to bring your problem to our team. Talk with you soon.

Hi Mitch,

Details mailed to you as requested, thanks for the reply.

1 Like