GrovePi and Co2 sensor

Grove is a modulated, ready-to-use tool set.
Much like Lego, it takes a building block approach to assembling electronics.

Moderators: violet, jeremy882, crail.lyu969

Post Reply
r0b0tn1k
Pre-kindergarten
Pre-kindergarten
Posts: 1
Joined: Fri Apr 27, 2018 3:13 am

GrovePi and Co2 sensor

Post by r0b0tn1k » Thu Oct 11, 2018 4:44 am

Hi,

I have GrovePi Zero and Co2 sensor (MH-Z16).

I tried to execute the example python code provided here: https://github.com/DexterInd/GrovePi/bl ... _sensor.py

However, I am getting following error:

Code: Select all

pi@raspberrypi:~ $ python co2.py 
Traceback (most recent call last):
  File "co2.py", line 51, in <module>
    ser = serial.Serial('/dev/ttyUSB0',  9600, timeout = 1)	#Open the serial port at 9600 baud
  File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 236, in __init__
    self.open()
  File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'
pi@raspberrypi:~ $ 
This is what I get for dmesg | grep tty:

pi@raspberrypi:~ $ dmesg | grep tty

Code: Select all

[    0.000000] Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:C8:F7:58 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=PARTUUID=cdf82148-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
[    0.000711] console [tty1] enabled
[    0.787229] 20201000.serial: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2
[    0.789769] console [ttyS0] disabled
[    0.789828] 20215040.serial: ttyS0 at MMIO 0x0 (irq = 160, base_baud = 31250000) is a 16550
[    0.789917] console [ttyS0] enabled
I did the installation instructions here: https://www.dexterindustries.com/GroveP ... -software/

Please let me know what I'm doing wrong?

bill.yu
Elementary-2
Elementary-2
Posts: 227
Joined: Mon Apr 02, 2018 11:05 am

Re: GrovePi and Co2 sensor

Post by bill.yu » Tue Oct 16, 2018 3:05 pm

Hi there,

Please check https://github.com/DexterInd/GrovePi/tr ... co2_sensor and let us know if any issue. thanks.

Post Reply