Giter VIP home page Giter VIP logo

micropython's People

Contributors

atx avatar aykevl avatar blmorris avatar chipaca avatar danicampora avatar deshipu avatar dhylands avatar dlech avatar dmascord avatar dpgeorge avatar flowergrass avatar glennrub avatar iabdalkader avatar jepler avatar jimmo avatar jongy avatar lurch avatar maureenhelm avatar mcauser avatar mrsurly avatar peterhinch avatar pfalcon avatar pi-anl avatar prusnak avatar robert-hh avatar rolandvs avatar stinos avatar tomlogic avatar tve avatar xbe avatar

Stargazers

 avatar  avatar  avatar

Forkers

thinktransit

micropython's Issues

SoftUART with MH-Z19B

Hello Damien,
I tried your softuart with two (one at a time) MH-Z19 Co2 sensor https://www.winsen-sensor.com/d/files/infrared-gas-sensor/ndir-co2-sensor/mh-z19b-co2-manual(ver1_6).pdf. Doesn't work.

I did some further investigations, it reads CO2 values, but my code is very different from the commands stated in datasheet (200105).

Communication between ESP8266 and PC over FTDI UART to USB works flawless.

No it does not. The behavior is hard to describe, lets say some sequences of bytes are ok (200105).

When I hook up the sensor, the answers from MH-Z19 don't make sense. My initialization with readout goes like this:

from machine import SoftUART
from machine import Pin
import time
softuart = SoftUART(Pin(4), Pin(5), baudrate=9600, timeout=1, timeout_char=2)
time.sleep(2)
softuart.write(b"\xFF\x01\x86\x00\x00\x00\x00\x00\x79")
time.sleep(1)
r=softuart.read(9)
print(r)

FF 01 86 00 00 00 00 00 79 (command to readout)

FF 86 02 3E 46 00 00 00 F4 (answer from 1st sensor over FTDI UART)
FF 86 01 9A 00 00 00 00 DF (answer from 1st sensor over FTDI UART)

Both make sense.

b'\xff\x86\x02&G\x00\x00\x00\x0b' (answer from 1st sensor over ESP8266)
b'\xff\x86\x02XH\x00\x00\x00\xd8' (answer from 1st sensor over ESP8266)

Well.

Setting timeout to 1 gives values "closer to good". Playing with timeout_char has almost no influence.

MH-Z19 uses a STM32 µC.

Maybe you give it a try with https://github.com/plerup/espsoftwareserial which runs pretty good and is still supported. There are some examples on github which use a MH-Z19 and an ESP8266 on the Arduino platform. I'm positiv that it's possible to communicate with an ESP8266 over software UART on the Micropython platform to devices.

I really appreciate your good work.

hcet14

SoftUART Example Code

Hi Damien,
Do you have a MicroPython example code on how to use your SoftUART library with the ESP8266?
Is it possible to update your fork with the latest master branch of MicroPython?
Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.