FrustratedLet Down

Spark fun just lost a customer.  I put in a support ticket on Saturday.  I heard back on Thursday.  Here is the support communication from January 19:

SparkFun Customer
Subject: [ Tech Support Request ]


JAN 19, 2017  |  02:27PM MST 

Hello form SparkFun,

Most of the issues with this board are born out of what seems to be a torsion issue.
Try fixing up your shield so that it is plugged in with the least stress possible.
Many users separate the two boards as far as possible while maintaining connection.
I wish I could support this issue better, but that is my advice to you for now.

I hope that helps,

——————————————————————————————————-

My response:

Hello…,

Thank you for the reply.  I have tried what you suggest repeatedly.  It didn’t work.  Plus, the answer you gave is more like “swing a chicken around your head 3 times…”

 
What else should i be trying?
thank you and kind regards,
Margaret.
——————————————————————————————————-
JAN 19, 2017  |  03:39PM MST 

Yeah this product fails like this and the engineers do not know why.

I very recently helped a similar customer.
The solution I provided was to simply send them a new unit that I tested and confirmed.
As soon as they put their own headers on the unit it stopped working.

For this consistent problem, I would like to offer a different solution for you.

We sell three other boards with the same chip as this that work very well and without these known issues.
Thing, Thing Dev, and Blynk.

Would you be happy taking store credit for this unit in order to purchase a better one?

I wish this was easier to support,

——————————————————————————————————-

I will run a request for you.

Please respond to this email to make my process easier.
I will have an answer for you tomorrow.

Thanks for your patience,

——————————————————————————————————- 

ChallengesBringOpportunites CHALLENGES BRING OPPORTUNITIES!

You know what?  micro python.  I’m gonna see if I can get a Wemos D1

I’ve had kicking around with the Grove Base Shield attached using micro python will work to do all the sensor reading and automation stuff.  OH YEAH OH YEAH….Take THAT SPARK(NO)FUN.  THANK YOU for nudging me into try micro python for this project.  I am stoked.  Luckily I am a hobbyist and not a professional or I am sure my employer might question my choice to do this :-)…ah learning, I L-O-V-E it!!!!…Alright, I must tell myself bumbling around is ok – just not TOO much….see you at the other end of the rabbit hole.

D1 Running Micropython

To communicate over serial, the D1 uses the CH340/CH341.  I needed to install the Wch USB serial driver.  Then I uploaded the latest version of micropython from here and following the directions from here.

With the D1 + Grove Base Shield plugged into a USB port on my Mac:

NewImage

To get the path to the wch usb serial driver, I opened up terminal and typed ls /dev/cu*

ls /dev/cu*

/dev/cu.Bluetooth-IncomingPort/dev/cu.Bluetooth-Modem/dev/cu.wchusbserial14530

As noted here: “For everything that’s not a modem or that’s not intended to be shared between call-out/call-in processes, you should use the /dev/cu. as this gives you exclusive access to the device.”

I got this line from here and modified for my setup and the version of micro python I downloaded.  Running this line at a terminal prompt:

esptool.py -p /dev/cu.wchusbserial1450 write_flash -fm dio -fs 32m -ff 40m 0x00000 esp8266-20170108-v1.8.7.bin 

the latest version of micro python was now installed.  The user’s manual is located here.  Using Coolterm, I got the the micro python (REPL) interface:

NewImage

Then I put the Grove Base Shield on the D1 and ran the lines from here:

NewImage

A YIPPEE moment!  It worked!  At least the results seem reasonable…. on to monitoring the CO2 level.  This requires Software Serial.  Let’s see…

FrustratedSENSORS PLEASE USE I2C NOT UART

Here’s the thing. The MH-Z16 CO2 sensor which is what the Grove CO2 sensor is – communicates using UART.  Thanks to the Arduino IDE’s SoftwareSerial library, there is a lot more flexibility to pins that can be used.  Unfortunately, the micro python IDE is evolving.  While there appear to be folks who have posted equivalent SoftwareSerial code, it doesn’t have the ease of use and stability I have come to love with the Arduino IDE’s SoftwareSerial.  

Now the challenge.  The micro python library (from machine import UART) supports only UART0 for RX/TX.  Well guess what?  REPL uses UART0.  Hmmm… so then I ran across

WebREPL

I followed Adafruit’s handy Access/Enable WebREPL tutorial

 NewImage

 

Now onto the UART.  I moved the Grove CO2 sensor to the UART connector.  From the UART class doc:

from machine import UART

uart = UART(0,9600)

According to the  MH-Z16 data sheet, the UART settings are:

NewImage

UART class micro python:

>>> from machine import UART
>>> uart = UART(0,9600)
>>> uart
UART(0, baudrate=9600, bits=8, parity=None, stop=1, timeout=0, timeout_char=2)
>>> uart.init(timeout=1)
>>> uart
UART(0, baudrate=9600, bits=8, parity=None, stop=1, timeout=1, timeout_char=2)

the 9 byte command to get a reading and reading the data into a buffer:

>>> gasdata = bytearray(9)
>>> uart.write(b’\xFF\x01\x86\x00\x00\x00\x00\x00\x79′)
9
>>>
MicroPython v1.8.7-7-gb5a1a20a3 on 2017-01-09; ESP module with ESP8266
Type “help()” for more information.
>>> ;i
Traceback (most recent call last):
File “<stdin>”, line 1
SyntaxError: invalid syntax
>>> uart.readinto(gasdata)
>>> gasdata
bytearray(b’\x00\x00\x00\x00\x00\x00\x00\x00\x00′)

Simpson DOHREPEATING THE SAME THING OVER AND OVER IS CRAZY

 Hmmm…how many times did I try write/read over uart0 using the lines above before I decided to pull out the extremely wonderful saleae logic analyzer

OOOH…a cliff hanger…can I get the CO2 sensor to work?  On the next episode….

 

Advertisements