January 4, 2017 at 11:44 pm #288
Ray and his contributors have come up with many great products and have been kind enough to provide them to others as open source. I have limited knowledge and experience with Arduino and with esp8266 and I decided to build my own opengarage as a learning experience.
I decided to use the Wemos d1 mini esp8266 breakout board because of its online support, its built in USB to serial chip for programming the Wemos, its 3.3v regulator and because of the shields available for it which further simplified adding relays and other peripherals.
My goal was to get the opengarage firmware working on the Wemos and to also add a dht22 temperature and humidity sensor. I decided to document my experience in case others are interested in doing something similar and would appreciate some tips as to what I did and what problems I encountered.
Below is the bill of materials for the parts I decided to use, I sourced them from Aliexpess.com
• Wemos D1 mini
• US-100 ultrasonic sensor
• Wemos D1 mini relay shield
• Generic pushbutton
• Generic piezo buzzer
• Most recent Arduino ide Arduino.cc
• Boards file for Wemos D1 mini (esp8266)
o In the Arduino IDE go to File | Preferences | Additional Boards Manager URLS: and paste in (http://arduino.esp8266.com/stable/package_esp8266com_index.json)
o Then go to Tools | Board | Board Manager and search for esp8266, ***MAKE SURE TO SELECT VERSION 2.2.0 and not 2.3.0***
• Esp8266 library
o In Arduino IDE go to Sketch | Include Library | Manage Libraries and search for esp8266.
• Blynk library
o Same process as getting the esp8266 library
• Adafruit DHT library
o Same process as getting the esp8266 library
• Simpletimer library
o Same process as getting the esp8266 library
• Open garage library opengarage github
o Download OpenGarage-Firmware-master.zip and unzip the file
o Now go into the folder you just unzipped and make a zip file of just the OpenGarage folder.
o Go back to the Arduino IDE and click on Sketch | Include Library | Add .zip Library and chose the OpenGarage.zip file just created.
• Nodemcu firmware flasher nodemcu
Observations / issues I came across
• Make sure to pick esp8266 version 2.2.0 when selecting boards file. When I selected the newest version 2.3.0 I got async error. Downgrading to version 2.2.0 fixed the problem.
• When testing the Wemos D1 mini on a breadboard make sure to either have an ultrasonic sensor connected or the board will go into a continuous reboot because the watchdog is looking for a distance sensor.
• If you decide to us the US-100 ultrasonic sensor, there is a jumper on the back of the board, make sure to remove the jumper or else the sensor will not work with opengarage.
• When using a DHT22 sensor either make sure to get one on a breakout board or put in a 4.7k resistor between the data and vcc pins
Modifications to Arduino software required by opengarage
• Go to the open garage master firmware folder downloaded from github and then go to the Modifcations folder.
o Copy BlynkSimpleEsp8266.h and paste it into Documents | Arduino | libraries | blynk-library-0.4.2 | src
o Also, copy Updater.h and paste it into C: |Users | (name of your computer user) | AppData | Local | Arduino15 | packages | esp8266 | hardware | esp8266 | 2.2.2 | cores
Adding the DHT senor and library
• I used Notepad ++ to make changes to the firmware easier: Notepad++
• On your computer go to documents | Arduino | libraries | Open garage and open defines.h with notepad ++
o You will want to pick a free pin to use on your Wemos D1 mini for the dht22 sensor. Note that the opengarage firmware references GPIO pins and not physical pins. You will have to go to wemos.cc to get a diagram of the pins and match them with GPIO pins.
o For example, say you want to use pin D4 on the Wemos for DHT sensor, you will have to actually reference GPIO2 in the firmware.
o So in order to use pin D4 add the following line to defines.h under GPIO pins, [#define DHTPIN 2] and [#define DHTTYPE DHT22]
I have attached the defines.h file with the necessary changes highlighted in purple.
• Now open in the open garage library where you found defines.h, open main.cpp in notepad++ and make the following changes: please see the attached main.cpp file and note the changes highlighted in purple.
Programming the Wemos D1 mini
• First open the nodemcu flasher application
o Open the nodemcu-flasher-master folder and choose either win32 for 32bit windows or win64 for 64 bit windows and open ESP8266Flasher.exe
o Select your com port that your wemos d1 is connected to
You can find this port by going to windows device manager
o Hit flash on the esp8266flasher and wait for the wemos d1 to program.
• Now if you just want to use the firmware file I attached without making any pin changes you can go to config in the esp8266 flasher and hit the gear icon on the top line and select the firmware file (.bin) that I have posted. Then go back over to operation and hit flash.
• If you want to make changes to the pins in defines.h or make any other changes to main.cpp etc you must compile the firmware with the Arduino IDE.
o After making the changes to the files open the Arduino IDE and go to File | Examples | OpenGarage | mainArduino and then go to Sketch | Upload
Your Wemos D1 should now be programmed, it will create an AP named OG_XXXX (with the x’s representing the Wemos mac address), connect to this network and follow directions to setup your open_garage.
The files I mentioned can be downloaded from my google drive: Files
If you decide to to use my firmware file without modifying the pins here is how i have them setup
#define PIN_RELAY 5 #define PIN_BUTTON 0 #define PIN_TRIG 12 #define PIN_ECHO 14 #define PIN_LED 2 #define PIN_RESET 16 #define PIN_BUZZER 13 #define DHTPIN 4January 8, 2017 at 2:55 pm #292
Cool. Thanks for sharing!March 2, 2017 at 4:39 am #405
You can find the D1 mini’s pinout here (Wemos removed the direct link from their page)
Wemos D1-miniFebruary 20, 2018 at 7:24 pm #973
Thanks a lot for putting this together. I am planning on doing the same exact thing (but was planning to use DHT11, not the 22). Why did you choose the DHT22 versus the 11?
Any idea why board version 2.2.0 is needed? Did you try to setup a local Blynk server? I just got it running, and was planning on using that for this project.February 20, 2018 at 7:25 pm #974
Was also wondering if you did (or have seen) a Fritzing image of the hardware project.March 7, 2018 at 3:32 am #1036
Firstly thanks for providing the above instructions. I’ve tried to follow them, however I’m not entirely sure what the overall result is once everything has been done.
I’ve been running open garage with a NodeMCU for the last month or so with no issues, and simply not done anything with the connected DHT22 yet.
How exactly do you read the temp/hum once everything is done? I thought perhaps something would show in the in-built web frontend, or maybe I should set something up with blynk, or even if you use MQTT it may broadcast there.
So – what exactly should I expect?
I think your post possibly used to have screenshots but now these aren’t there, so it’s been a struggle to follow 🙂
Perhaps you could do a fork of https://github.com/OpenGarage/OpenGarage-Firmware and uploading the sensor changes there? 🙂
Regardless, this is what I have configured:
March 8, 2018 at 12:27 am #1052
- This reply was modified 1 year, 7 months ago by mattie47. Reason: added my config
@heyhogen: DHT22 has higher accuracy than 11, though price-wise is also quite a bit more expensive. If humidity isn’t necessary, there are plenty of low-cost temperature sensors out there like MCP9700/9701, or even a thermistor — these are analog sensors that ESP can read through its analog A0 pin.
The current OG firmware (1.0.8) is compiled with ESP8266 core 2.3.0. I am not sure Gompka said make sure to select 2.2.0 — the only issue we’ve encountered in the past is that 2.3.0 by default uses QIO mode, which caused problems on some ESP8266 chips. But once we explicitly tell it (in the Makefile) to use DIO mode, it seems to be fine.April 14, 2018 at 9:11 pm #1125
Is there a way to show the temp sensor data on the web page?
OpenGarage does not work with my MQTT server which needs authentication.June 2, 2018 at 2:40 pm #1159
You can modify the firmware and homepage HTML to show temp sensor data on the webpage. You can further add a Blynk widget to show temp data. The firmware is relatively easy to modify — you can add a temp sensor variable by following the example of some existing controller variable, such as door status.September 17, 2019 at 12:10 pm #1936
Hi….I especially like the led screen. I use the NodeMCU units as well, but with AM2303 sensors and a barometric sensor. I use one with the sensor and also LEDs to let me know if the hot water recirculate pump is on, or doors are unlocked. I have used the one-wire sensors similar to what you have done, but connected to a raspberry pi and use MQTT protocol to get the data into Homeseer. I haven’t attached the one-wire sensors to a NodeMCU before.
You must be logged in to reply to this topic.