Giter Site home page Giter Site logo

fridgetemps's Introduction

fridgeTemps

What's more exciting than displaying your refrigerator and freezer temperature on a small OLED? Nothing.

Sending temperatures with two DS18B20s, using a WeMos D1 Mini to share with the Blynk app, and displaying on a small OLED. OLED is "I2C interface 0.96" OLED 128x64 display module" from eBay.

Libraries and Resources

Title Include Link w/ IDE?
Adafruit_SSD1306 Adafruit_SSD1306.h https://github.com/adafruit/Adafruit_SSD1306 No
Adafruit-GFX-Library Adafruit_GFX.h https://github.com/adafruit/Adafruit-GFX-Library No
Wire Wire.h https://github.com/esp8266/Arduino NO!‡
SPI SPI.h https://github.com/esp8266/Arduino NO!‡
OneWire OneWire.h https://github.com/PaulStoffregen/OneWire No
Arduino-Temperature-Control-Library DallasTemperature.h https://github.com/milesburton/Arduino-Temperature-Control-Library No
‡See lessons learned below.

Many thanks to all of the people above. How to edit this.

Lessons Learned

###NodeMCU's ESP-12E (or any 8266-based board) versus the I2C OLED (w/ Arduino... not Lua)

I purchased a pretty plain OLED display (http://www.ebay.com/itm/130566448551) advertised as "I2C 0.96" OLED display module (compatible Arduino)" and further described as "I2C interface 0.96" OLED 128x64 display module." In the eBay listing there was a "source code" link and it mentioned it was tested and 100% compatible with Adafruit's code.

It in fact was! I attached the display to the SDA/SCL pins on my Arduino Uno and she worked great with Adafruit's SSD1306/GFX library! That is, after I:

  • Changed the I2C address from 0x3D to 0x3C. Therefore display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  • As notified during my first unsuccessful compile, changed the comment in line 69-70 of Adafruit_SSD1306.h (#define SSD1306_128_64) to include my OLED dimensions.

Almost a happy ending. Using the exact same code from the Uno for my ESP-12E, I couldn't get anything to display on the OLED. I then learned that unlike the Uno, the ESP8266 family (of which the NodeMCU/ESP-12E belongs) doesn't have defined "hardware-defined" SDA/SCL pins. They need to be defined in software. Therefore, lesson one:

  • Add Wire.begin(4, 5); as my first line in void setup()

This was a little tricky because the pinouts of the actual ESP8266 chip (the GPIO pins) don't correspond to the ESP-12E breakout pins (the D1, D2, D3, etc). For example, GPIO1 ≠ D1, GPIO5 ≠ D5, and this is true for every GPIO. It's a mix-up. Between locating some pinout diagrams that translated this for me, and trial-and-error running the LED blink example on various pins, I figured it out. So in my Wire.begin(4, 5); 4 is my SDA (that's GPIO4, but pin D1), and 5 is my SCL (that's GPIO5, but pin D2). Lordy.

Excited to have figured this out, I compiled... and... got an error: "Wire.h does not name a type." In other words, Wire.begin wasn't something in Wire.h. Gah. Oh but it was. Lesson #2:

  • If you're switching between two different "groups" of boards in Arduino IDE's board manager (such as Arduino standard, and ESP8266-family), each one of those might have it's own includes that are named exactly the same, but are actually different.

So get this: Wire.begin(4, 5); wouldn't compile... said it didn't exist in Wire.h. In the IDE I went to Tools -> Board, and changed from Uno to ESP-12E. Then I deleted #include <Wire.h>, went to Sketch -> Include Library, and selected Wire again. #include <Wire.h> pasted itself into the code. Doesn't seem any different, eh? It was! It is! This time it pulled the Wire.h from the ESP8266/Arduino library. Hit compile and it worked! Whheee!

But the OLED still didn't. I just needed to learn to read.

I was hell-bent (especially after seeing other peoples' glowing, pride-filled examples) to make the "stock" Adafruit library work with this OLED on my ESP-12E. I had started this whole process using Adafruit's example sketch ssd1306_128x64i2c. After not too much more cursing I learned lesson #4:

  • Change #define OLED_RESET 4 to #define OLED_RESET 0, or some number so it's not the same as whatever SDA/SLC you've picked!

This was just bad luck that the SDA/SLC pins I chose were defined as a reset in Adafruit's example sketch, but after changing it from 4 to 0, the OLED at last lit up on my ESP-12E.

FYI, all of this happened on Arduino IDE version 1.6.5.

fridgetemps's People

Contributors

structure7 avatar

Stargazers

 avatar

Watchers

 avatar

fridgetemps's Issues

Pull in Blynk

  • Transition code to timer-based (1 update/second?)
  • Create project auth (new called APPLIANCES?)

OLED font improvements

Get "smoother" font, especially for digits. Bench test code with spare display.

u8glib is the other display library I tried messing with. Maybe worth trying again.

I SHOULD DEFINITELY BE ABLE TO MAKE THIS WORK!!! Scroll down to the pic of mine at https://github.com/olikraus/u8glib/wiki/gallery and see the comment about a special option.

Idea for other OLED display info

  • Uptime in mins/hours/days
  • Add Kenmore logo as a refrigerator open "splash screen"
  • Tie into water dispenser? Notification, alarm, or recording of dispense duration?

12E pin choices

At startup, pins are configured as INPUT.
GPIO0-GPIO15 can be INPUT, OUTPUT, or INPUT_PULLUP.
GPIO16 can be INPUT, OUTPUT, or INPUT_PULLDOWN_16. It is also XPD for deepSleep() (Perhaps via a small capacitor.)
Note that GPIO6-GPIO11 are typically used to interface with the flash memory ICs on most esp8266 modules, so these pins should not generally be used.

From http://www.esp8266.com/wiki/doku.php?id=esp8266_gpio_pin_allocations

Door status: Tap LED (comes on with fridge only)

Hey-ooo! LED is ~2VDC and off when door is closed. For "high pins" might need to BJTs.

Looks like I have a bipolar LED situation (possibly). In which case I need to test what negate voltage does to a BJT gate.

Door status: Reed switch

Either a bare switch or a security-alarm style one might be the way to go if a decent way to route the detector wire is found.

-196 temp sensor error troubleshooting.

Seems to be associated with the defrost cycle starting. Probably 120VAC EMI in the cable chase.

Ideas/things to try:

  • Reinstall sensor with shielded cable and improved board connections.
  • Twist ground and signal wires.
  • Daisy chain sensors for space?

More ESP-12E Troubleshooting

Think I'm getting warm:

Perhaps only a minor note - in the current environment Arduino have certainly knohovnu OneWire - there will need to be rewritten newly supplied library, which is also part of the implementation package, otherwise the compiler will not know OneWire proNodeMCU. Just overwrite files .ha .cpp in this case.

From https://www.arduinotech.cz/inpage/nodemcu-wifi-modul-s-esp8266-496/

Takeaway: Is there any conflict between OneWire.h (used for Dallas) and Wire.h?

Idea for defrost dropout: Separate power source?

So it seems the temp sensor is getting an error. It's not that the WeMos is dropping out. Need to confirm this by removing the "don't report an error" code to see the true frequency in graph.

Try a complete isolated/external power source in lieu of the fridge. Wall wart or the like.

NodeMCU with I2C attached SHT21 sensor not working

I'm trying to get a real SHT21 I2C humidity and temperature sensor to work with a NodeMCU V1
with a ESP8266 -12E. I have been trying ReadSHT2x and SHT21_DEMO. I have the sensor with SDA to D1 and SLC to D2. So the defaults should work. The results are: 1) ReadSHT2x returns zero's so it prints the "failed" values like 0.00% and -459.40 F. SHT21_DEMO returns nothing! I have these same programs and the same sensor running perfectly on a UNO.

My concerns are does this AMICA NodeMCU have the I2C functions? I suspect not as they would exit through GPIO02 and GPIO14 which aren't defined. I read in forum's you must bit bang for I2C on this NodeMCU. However, the Wire.h and it's source file don't contain any bit banging. They call txBuffer and rxBuffer.

I tried "NodeMCU I2C with Arduino IDE", which had me attach the NodeMCU to the UNO directly and the I2C worked perfectly, each spoke to the other Master and Slave. But I suspect this isn't real I2C.

My background is I wrote my own bit banging on a MicroChip 16F88 to talk to the SHT21's and have about a dozen projects running today in Assembler. Only Assembler.

I want to get I2C talking to my sensors from this ioT NodeMCU. Can you please help?

I2C on ESP8266 (01 and 12E)

Serious look: Wire.h in ESP8266 vs Wire.h in core Arduino library

This references the ESP-01 specifically but probably need to at least experiment with it: https://github.com/adafruit/ESP8266-Arduino#i2c-wire-library (just noticed that's an Adafruit fork... hmmm... might need to compare the source files).

From ada:

I2C (Wire library)

Wire library currently supports master mode up to approximately 450KHz. Before using I2C, pins for SDA and SCL need to be set by calling Wire.begin(int sda, int scl), i.e. Wire.begin(0, 2); on ESP-01, else they default to pins 4(SDA) and 5(SCL).

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.