Jump to content

Scandinav21

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Scandinav21

  1. Armbianmonitor:

    Hi everyone.

    I almost gave up while reading tons of forums:(

    I bought CO2 sensor MH-Z19 from aliexpress.

    As I figured out this sensor used by RPi without any problems. Manual I found here:

    https://www.circuits.dk/testing-mh-z19-ndir-co2-sensor-module/

    I connected module as mentioned:

    Vin - 2 pin gpio
    GND - 9 pin
    Tx - 13 pin
    Rx - 11 pin

    Module was blinking when I powered on my OPi, but when I tried to send data to UART nothing happened. I got timeout.

    I tried to connect Tx and Rx (11 and 13 pin) by cable, then sent bytes and immediatley got answer, UART work, as I understood.

    I checked uart in armbian-config menu and all (1,2,3) was enabled.

    Orange PI PC Plus
    Linux orangepipcplus 5.4.30-sunxi #20.02.9 SMP Mon Apr 6 19:46:24 CEST 2020 armv7l GNU/Linux

    Can somebody help me, please?

     

    Spoiler
    
    import serial
    import time
    import subprocess
    import getrpimodel
    
    serial_dev = '/dev/ttyS2'
    stop_getty = 'sudo systemctl stop serial-getty@ttyS0.service'
    start_getty = 'sudo systemctl start serial-getty@ttyS0.service'
    
    def mh_z19():
        ser = serial.Serial(serial_dev,
                            baudrate=9600,
                            bytesize=serial.EIGHTBITS,
                            parity=serial.PARITY_NONE,
                            stopbits=serial.STOPBITS_ONE,
                            timeout=1.0)
        while 1:
            s=ser.read(9)
            result=ser.write("\xff\x01\x86\x00\x00\x00\x00\x00\x79")
            s=ser.read(9)
            print(s)
            if len(s) >= 4 and s[0] == "\xff" and s[1] == "\x86":
                return {'co2': ord(s[2])*256 + ord(s[3])}
            break
    
    def read():
        p = subprocess.call(stop_getty, stdout=subprocess.PIPE, shell=True)
        result = mh_z19()
        p = subprocess.call(start_getty, stdout=subprocess.PIPE, shell=True)
        if result is not None:
            return {'CO2': result["co2"]}
    
    if __name__ == '__main__':
    #  value = mh_z19()
    #  print "co2=", value["co2"]
        value = read()
        if value is not None:
            print "co2=", value["CO2"]
        else:
            print "None"

     

     

  2. Hi there.
    I've got the problem with boot from emmc when empty SD card is installed.

    Opi PC+
    Armbian (debian 9 stretch)
    Kernel 5.4.20-sunxi

    I've moved OS from SD to emmc using armbian-config util, then format SD with fat and now when I power on my OPi without SD card all is ok, but when SD installed boot get stuck with error "Script failed", unknown device...
    I've tried to chang mmc0‘s sdc_detmode, but doesn't have /boot/script.bin
    Can anyone help? Thank you.

     

    Spoiler

    7c932fda89d2b88622efd031f5ead311-full.jp

     

×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines