- web server
- status display
- rgb lighting
- temperature / humidity sensor
- smart door / smart lock
- wind turbine
- internet delay measurement
Web Server
The first version of the website on a mobile looked like (image left):
We used the jquery-colorpicker plugin but it was not really what we were looking for and somewhat broken on mobile phones. exco then hacked together (the google foo is strong in this one) a very fancy color wheel with nothing but js writing on a html5 canvas.
The final verision can be seen on the right.
The way that proved successfull on the esp was sending a „larger“ web page in a loop of small chunks.
Most resources (jquery, …) are pulled from cdn since the ESP doesn’t have a whole lot of storage and the cdn is faster delivering content anyways.
The esp lua and html code can be found on github.
Status Display
The first smart feature the home got was a display right into its window.
We use the cheapest display we could get from aliexpress, a 0.96 inch single color OLED display with 128×96 pixels. You can now buy them for under 5 dollars and these nifty displays only need two wires to attach it to the ESP or an arduino! This became very important for the final feature creep.
It got even better when we found out the u8g lib has already been ported to nodemcu on the ESP -> just import the library and write text on the display for profit. We found this to be a very cool pattern for all microcrontroller projects, add a display and BAM you have graphical output.
RGB Lighting
As second feature followed a ws2812b rgb led for interior lighting and a bootstrap website to control its color.
Temperature / Humidity
Just like every smart home the smallest smart home needed some real sensors. Makefu found a cheap Temperature/Humidity Sensor – DHT11 in one of his project boxes and the sensor was directly soldered to the esp.
Smart Door / Smart Lock
For no apparent reason makefu said we needed an automatic door – so it had to happend.
We professionally installed (read: hot glued) a small servo to the inside wall and conneted it to the door with a bent spring.
You don’t have to authenticate with your private key which makes it convenient to use but you shouldn’t choose that route for a home you live in.
Better use an openwrt box and public/private key authentication.
Wind Turbine
Samu really really wanted a wind turbine for our smart home so he ziptied a dc brushed motor onto an aluminum extrusion, added some unknown capacitor he found in some box for filtering sth, hot-glued it onto the base plate,added two wires plus a sop-23 mosfet and bailed out.
We decided to add a 10ohm 5W resistor to limit the max current (of particular concern to us was the the inrush current) to 0.5 amps and a pulldown on the mosfet controlling esp pin.
Internet Delay Measurement
In the beginning we just wanted to check how well the wireless network performs in terms of delay to the internet. To test this the ESP measures two steps within small time intervals:
1. Resolve google.de
2. Connect to google.de via HTTP GET / and wait for the response, then close the connection
This information then is displayed on both the website and the display as well as being send through the wireless pipes to the mqtt server on a virtual machine here at the shackspace.
This data is redirected to a graphite server where it can be viewed in clean graphs:
the nerd part:
ams1117 are a fast and cheap way to get the esp working on an USB port or USB charger.
The ESP cannot send chunks bigger than 1KB directly to the socket – the files have to be sent chunked to the client actually work.
Makefu implemented the function you can recycle for your projects:
function send_file(f) file.open(f,"r") block = file.read(1024) while block do client:send(block) block = file.read(1024) end file.close() end
So cozy inside (no space for blackjack and the rest)
how the smart house began
ESP8266 connections:
(before: left)
GPIO4 broken (for no apparent reason)
GPIO5 ws2812b
GPIO00 pull-up 10k and door servo
GPIO02 pull-up 10k and DHT11 temperature & humidity sensor
GPIO 14 pull-down 10k (because of the mosfet) windturbine
GPIO 12 + 13 128×64 oled
(after: right)
from SpaceBlogs http://ift.tt/1NL7AaQ
via IFTTThttp://ift.tt/1NL7zUg
No comments:
Post a Comment