dmascord / micropython Goto Github PK
View Code? Open in Web Editor NEWMicropython fork with SoftUART support
License: MIT License
Micropython fork with SoftUART support
License: MIT License
how to compile?
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,
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.