Hi,
I have GrovePi Zero and Co2 sensor (MH-Z16).
I tried to execute the example python code provided here: <LINK_TEXT text=“https://github.com/DexterInd/GrovePi/bl … _sensor.py”>https://github.com/DexterInd/GrovePi/blob/master/Projects/CO2_sensor.py</LINK_TEXT>
However, I am getting following error:
</s><i>
</i>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:~ $
<e>
This is what I get for dmesg | grep tty:
pi@raspberrypi:~ $ dmesg | grep tty
</s>[ 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<e>
I did the installation instructions here: <LINK_TEXT text=“https://www.dexterindustries.com/GroveP … -software/”>https://www.dexterindustries.com/GrovePi/get-started-with-the-grovepi/setting-software/</LINK_TEXT>
Please let me know what I’m doing wrong?