helium.communicationError: 2


Apologies in advance: This might well be user error. I’m new to python and serial port programming. I’ve bumbled my way through some raspi and arduino projects in the past, but that was probably luck.

I have the Element connected, and online, and I’ve activated the Atom as well. Using a Raspi 3 model B. I disabled the console for the serial port as recommended. Trying to run your basic.py example, and getting an error.

Traceback (most recent call last):
  File "basic.py", line 4, in <module>
  File "helium_client/_helium.pyx", line 190, in helium_client._helium.Helium.connect (helium_client/_helium.c:2671)
  File "helium_client/_helium.pyx", line 120, in helium_client._helium._check_result (helium_client/_helium.c:1903)
helium_client._helium.CommunicationError: 2

Here’s the script. I didn’t modify any code beyond changing the serial port.

from helium_client import Helium

helium = Helium("/dev/ttyAMA0")

channel = helium.create_channel("Tempathic MQTT")
channel.send("Serial test")

Checking the serial ports:

dmesg | grep tty


[    0.000000] Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait splash plymouth.ignore-serial-consoles
[    0.001246] console [tty1] enabled
[    1.082324] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[    1.091939] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 220, base_baud = 31250000) is a 16550

I don’t know which port I’m supposed to use. Leaving it at serial0 does nothing.


Sorry to hear you’re having issues with the serial port @yamini.

You should not be using dev/ttyAMA0 as the serial port. It’s a generic device that needs to be configured to represent serial.

If /dev/serial0 does not exist it’s likely you did not configure the serial device correctly. Can you make sure you used raspi_config to disable console login and enable serial ports; then hit finish and reboot the device?


@marc I confirmed that the console login was disabled and serial ports enabled. Rebooted. Changed the script back to reference /dev/serial0. No luck.

I then checked /boot/config.txt and verified enable_uart=1. Rebooted again, but still no change. I also tried swapping the ports with an overlay, to see if that helped. I now see the following, when I check:

ls -l /dev


But the script still does nothing when I run it.


That’s so bizarre. Does /dev/serial1 also not work with that setup?
Also, could you share a quick picture of the board as you have it set up?


This post was flagged by the community and is temporarily hidden.


@yamini would you be able to share

  1. how you set up the overlay
  2. a picture of your board with the Atom?


@yamini It looks from the image that you have the Atom inserted the wrong way around. Could rotate it 180 so that the antennas face towards the"hat" image on that shield? It’s going to fit in just slightly off since those two jumpers lift the back of the Atom up a bit but it should work.


@marc Thanks for catching that! Seems to be working now. I can see it in the Helium dashboard and there are a few events. It’s not sending any data though:

Traceback (most recent call last):
  File "basic.py", line 7, in <module>
    channel.send("hello from Python")
  File "helium_client/_helium.pyx", line 351, in helium_client._helium.Channel.send (helium_client/_helium.c:4714)
  File "helium_client/_helium.pyx", line 272, in helium_client._helium.Helium._channel_send (helium_client/_helium.c:3930)
  File "helium_client/_helium.pyx", line 261, in helium_client._helium.Helium._channel_response (helium_client/_helium.c:3605)
  File "helium_client/_helium.pyx", line 120, in helium_client._helium._check_result (helium_client/_helium.c:1903)
helium_client._helium.NoDataError: 1


@yamini Let me look into that real quick, it looks like the MQTT channel is having a hickup


@yamini ok, we had a channel hiccup. You should be all good now


@marc That went through great. Thanks for your help!