Having had always "not enough" memory trouble on the ESP8266 Thing while trying to get the Bosch Sensortec BMP180 running ... here is the ultimate step by step tutorial how you will get the sensor running!
First you do need an older version of the nodeMCU, go with this one:
python /home/pi/esp/esptool-master/esptool.py --port /dev/ttyUSB0 write_flash 0x00000 nodemcu_20150123.bin
(we are using the Raspberry Pi and python tool chain to flash the ESP8266 Thing, don't forget to set GPIO0 to GND while flashing nodeMCU and remove afterwards, reboot)
Now we are ready to flash the LUA scripts:
python /home/pi/esp/luatool-master/luatool/luatool.py --port /dev/ttyUSB0 --src bmp180.lua --dest bmp180.lua --verbose
python /home/pi/esp/luatool-master/luatool/luatool.py --port /dev/ttyUSB0 --src bmp.lua --dest bmp.lua --verbose
Again we are using the Raspberry Pi as part of the toolchain, here we do get an console to the ESP8266 Thing:
screen /dev/ttyUSB0 9600
and can now run the sensor reading script, like this:
NodeMCU 0.9.5 build 20150123 powered by Lua 5.1.4
> dofile("bmp.lua")
Temperature: 24.1 deg C
Temperature: 75.3 deg F
Pressure: 96616 Pa
Pressure: 966.16 hPa
Pressure: 966.16 mbar
Pressure: 724.6 mmHg
>
Done! gerat our first I2C sensor the ESP8266 Thing is up and running ...
For your reference the HW wiring of Sparkfun BMP180 with Sparkfun ESP8266 Thing:
BMP180 (+) --> 3.3V
BMP180(-) --> GND
BMP180(CL) --> SDA (GPIO15)
BMP180(DA) --> SCL (GPIO2)
Trick: If your are not sure if the I2C sensor devices is correctly wired or on which I2C address it is configured use this great tool:
https://github.com/docice/esp8266/blob/master/i2c_scanner.lua
BMP180
> dofile("i2c_scanner.lua")
Scanning all pins for I2C Bus device
Device found at address 0x77
Device is wired: SDA to GPIO - IO index 4
Device is wired: SCL to GPIO - IO index 5
HTU21D
> dofile("i2c_scanner.lua")
Scanning all pins for I2C Bus device
Device found at address 0x40
Device is wired: SDA to GPIO - IO index 5
Device is wired: SCL to GPIO - IO index 4
Some I2C libs are requiring the "float" version of the nodeMCU:
python /home/pi/esp/esptool-master/esptool.py --port /dev/ttyUSB0 write_flash 0x00000 nodemcu_20150213.bin
Comments
Please log in or sign up to comment.