NodeMCU as serial datalogger?

Out of curiosity, has anyone been able to/tried to use a NodeMCU (not LUA, using the Arduino software) as a serial datalogger?

I’ve got one hooked up to my Pro Mini (via a CD4050BE logic level converter,) but the NodeMCU isn’t reporting any serial data incoming. (I’ll post the code from both sides in attachments.)

utilmon.ino (2.11 KB)

datalogger.ino (9.89 KB)

If this was working as expected, the datalogger would post to my locally-hosted emconcms installation, as well as display the results on the attached Nokia 5110 display.

Things work correctly if I'm connected via the arduino software (I can post data to the serial monitor, and it processes as expected. It just doesn't seem to work when connected to the tx and rx pins on the nodemcu.

(I'm running a NodeMCU version 1.0 and the Arduino 1.6.5 software.)

Ok, I figured it out. I stumbled across this thread and discovered that apparently the CD4050 isn't supposed to be used for stuff like this. I switched over to a mosfet-based logic level converter, and it works now :slight_smile:

So, I'm not sure why Adafruit (and others) are suggesting to use a 4050 for stuff like this? If I'd have known that was the case, I'd have saved about 10 bucks on ebay :confused:

Adafruit site shows a HEF4050, not CD4050.
"The HEF4050B provides six non-inverting buffers with high current output capability suitable for driving TTL or high capacitive loads. Since input voltages in excess of the buffers’ supply voltage are permitted, the buffers may also be used to convert logic levels of up to 15 V to standard TTL levels. "

TI part number is cd74HC4050.
48 cents at Digikey

Ha! Nice, that would definitely explain it then… :confused: Thanks CrossRoads!

On a positive note, this is all working properly now. I had to tweak the code of the datalogger a bit because in my “java developer-ness” I forgot that the C family passes pointers rather than values when doing assignments, so I switched things around a bit to use an array instead (attached.)

When setting the"fromPC" value to true, this is what shows up on the serial monitor; the LCD just displays like

PF2:0.86
W:1374.97
V:123.72

while the serial monitor displays like

PF2,0.86
PF2:0.86    
HTTP/1.1 200 OK

Date: Sat, 02 Jan 2016 13:29:02 GMT

Server: Apache/2.2.22 (Debian)

X-Powered-By: PHP/5.4.45-0+deb7u2

Content-Length: 2

Connection: close

Content-Type: application/json



ok
W,1374.97
W:1374.97   
HTTP/1.1 200 OK

Date: Sat, 02 Jan 2016 13:29:04 GMT

Server: Apache/2.2.22 (Debian)

X-Powered-By: PHP/5.4.45-0+deb7u2

Content-Length: 2

Connection: close

Content-Type: application/json



ok

datalogger.ino (11.5 KB)

chrismyers81:
Out of curiosity, has anyone been able to/tried to use a NodeMCU (not LUA, using the Arduino software) as a serial datalogger?

I've got one hooked up to my Pro Mini (via a CD4050BE logic level converter,) but the NodeMCU isn't reporting any serial data incoming. (I'll post the code from both sides in attachments.)

Doesnt the nodeMCU board already works with 3.3v? why do you use a logic level converter?