-
Notifications
You must be signed in to change notification settings - Fork 0
/
doorbell.html
197 lines (183 loc) · 12.6 KB
/
doorbell.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>David McPhee's Personal Homepage</title>
<link rel="shortcut icon" type="image/png" href="includes/favicon.png">
<link href="includes/main.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-C8K8BK48K1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-C8K8BK48K1');
</script>
<body style="background-color:#121212;">
<div id="content">
<div id="nav">
<ul>
<li><a href="/projects">Back To Projects</a></li>
</ul>
</div>
<!-- End Header $include_path/header.html -->
<div class="main">
<div class="bTitle"><p><u><strong>OLED Doorbell</strong></u><p /></div>
<img class="bImg" src="/includes/projects/doorbell/thumbnail.jpg" alt="Thumbnail for OLED doorbell"></img>
This is an OLED attachment to the doorbell to display messages and images. It is connected via WiFi
and can be controlled via a phone with internet. This all started with the wife needing a way to
stop people from ringing the doorbell whilst Anne was sleeping.
<div class="bSub"><p><b>Parts List</b><p /></div>
Here is the list of materials and tools used for this project. Arduino software
as well as FreeCAD was used for the programming and 3D design, respectively.
<div class="cText"><p />
1. ESP 8266 Microcontroller with WiFi<p />
2. Adafruit 128x64 OLED screen<p />
3. Custom 3D printed case<p />
4. Cables and soldering<p />
3. Multimeter / Oscilloscope<p /></div>
<div class="bSub"><p><b>Hardware</b><p /></div>
The ESP 8266 microcontroller is a good choice for this project because it has a large RAM,
WiFi enabled, and small form-factor. The Adafruit OLED has pins for serial connection
and power supply from the ESP board. These two pieces of hardware were connected with
via a breadboard for the software design and integration.
<img class="bImg" src="/includes/projects/doorbell/img1.jpg" alt="Hardware on breadboard"></img>
<div class="bSub"><p><b>Software</b><p /></div>
The ESP board uses C code and was coded with the Arduino IDE. To enable WiFi communication,
the ESP8266WebServer library was used to initialize the controller. The board first
initializes the OLED screen and then attempts to connect to the WiFi network. After
a successful connection, the URL is printed on the OLED screen. The server (ESP board)
waits until another computer requests an http connection at which point it sends the
index page. <a href="/includes/projects/doorbell/example_doorbell_index.html">Here</a> is an
example of the webpage hosted by the ESP board. The page has three different options to
display messages on the OLED screen. The first two large buttons for quick messages.
When a user selects a button, the appropriate text is written to the OLED screen and a
confirmation page is sent back to the user. The second message option is custom text.
The custom text is entered by the user and sent to the server to display on the OLED.
The final message type is an image. These images are preset but can be altered within
the arduino code. Users cannot upload images due to the lack of RAM on the ESP board.
The bitmaps of the preset images are stored in the bitmaps.h file on the github repo and
can be changed using <a href="/includes/projects/doorbell/image2oled.html">this tool</a>
that I have published on this website.
<div class="bSub"><p><b>3D Design and Printing</b><p /></div>
The plan for this project was to mount the OLED attachment to the doorbell which meant
it would be outside and for everyone to see. Therefore presentation is important which
meant that I could not just shove it in a recycled container and nail it to the wall.
I used FreeCAD 0.19 which worked very well and I highly recommend it for anyone looking
to create something similar in scale. I followed a couple of tutorials and soon enough
I had a good design. The local library has a 3D printer and it only cost $4 which is
significantly cheaper than buying my own 3D printer. The first iteration was okay but the
lid was too big for the box and did not slide on. I went back to freeCAD and added some
margin for machine-error and tried again. This time the lid did fit which was relieving.
<img class="bImg" src="/includes/projects/doorbell/img2.jpg" alt="3D Case 1 of 3"></img>
<img class="bImg" src="/includes/projects/doorbell/img3.jpg" alt="3D Case 2 of 3"></img>
<img class="bImg" src="/includes/projects/doorbell/img4.jpg" alt="3D Case 3 of 3"></img>
<div class="bSub"><p><b>All Together</b><p /></div>
I installed the hardware and cabling into the case with some solder and electrical tape.
The pins on both boards are catered toward jumper cables rather than solder so I did a
combination of both.
<img class="bImg" src="/includes/projects/doorbell/img6.jpg" alt="Hardware installed (1/2)"></img>
<img class="bImg" src="/includes/projects/doorbell/img5.jpg" alt="Hardware installed (2/2)"></img>
With everything installed I powered it on using a microUSB plugged into a hole I added to
the side of the casing. It worked well and the only thing left to do was install it onto the wall.
<img class="bImg" src="/includes/projects/doorbell/thumbnail.jpg" alt="Working electronics in case"></img>
<div class="bSub"><p><b>Power Supply</b><p /></div>
The ESP board requires 3.3V DC power. Typically this can be achieved one of two ways. Either via
a dynamic power supply such as a computer, or a special adapter. The former works with a USB
cable and the ESP board and computer communicate to deliver the correct amount of power. The latter
works because the manufacturer supplies a wall plug that converts the 120V AC power to 3.3V DC.
There are no computers near the doorbell so my best option was to go with the wall plug, however
the closest wall plug is about 10ft away. This led me to a great, but disastrous, idea. The
doorbell has power so I could just create a custom power adapter that converts the doorbell
power to ESP power.
<p />
After some research I realized that the doorbell is most likely powered with a lower level of AC
power. To confirm this theory, I connected my multimeter across the doorbell to measure the power.
(I also had some help with this step from my wife and daughter)
<img class="bImg" src="/includes/projects/doorbell/img8.jpg" alt="Doorbell power (1/3)"></img>
<img class="bImg" src="/includes/projects/doorbell/img9.jpg" alt="Doorbell power (2/3)"></img>
<img class="bImg" src="/includes/projects/doorbell/img10.jpg" alt="Doorbell power (3/3)"></img>
The measured power was around 21V AC which confirmed the research. This meant that I had to create
an adapter that went from 21V AC to 3.3V DC. I planned this conversion to happen in two stages. The
first was to rectify the AC power to DC and then step down the DC power to 3.3V. For AC to DC, one
of the best circuits to use is called a Full Bridge Rectifier.
<img class="bImg" src="/includes/projects/doorbell/img11.jpg" alt="Full Bridge Rectifier"></img>
I installed the rectifier to the doorbell and sure enough it converted the power to DC. To step
down the power I used an IC regulator. This regulator can have a variable output power by changing
the two resistors on the two outputs.
<img class="bImg" src="/includes/projects/doorbell/img12.jpg" alt="Circuit Diagram"></img>
The equation for the output power was supplied in the datasheet and I used Python to calculate
the ideal resistor ratio. I did the math for the correct resistors and bought the components
from Digi-Key.
<img class="bImg" src="/includes/projects/doorbell/img15.png" alt="Regulator math"></img>
When I installed everything, I didn't get the output power I expected which was odd. I double-checked
my math and the circuit connections. I found when I installed the regulator in different orientations,
I got slightly better results.
<img class="bImg" src="/includes/projects/doorbell/img13.jpg" alt="adapter connected to doorbell"></img>
<img class="bImg" src="/includes/projects/doorbell/img14.jpg" alt="Testing step-up"></img>
I dug through my resistor collection and started trying different combinations. The problem was that
I am colorblind so I couldn't read the resistor code. I got my wife to help and had a set-up like this:
<img class="bImg" src="/includes/projects/doorbell/img16.png" alt="Testing step-up"></img>
I kept testing the resistors but my predictions always missed the actual results. At one point I did
have an output power of 3.3V yet the ESP power was not powering on. I decided to start hot-swapping
resistors which was a terrible idea. I started to smell burning and quickly unplugged everything. I
went back to my computer and plugged in my board to the dynamic power supply. I got a notification on
my computer that the device I connected was requesting more power than the computer could deliver, uh oh.
After about 5 seconds I heard a pop and smoke starting coming from the board. I destroyed the regulator and
thus the board.
<div class="bSub"><p><b>Investigation</b><p /></div>
I decided to investigate why the power output of my adapter wasn't what I expected. Firstly I verified the
output of the doorbell power. I used an oscilloscope this time to give a proper 2D representation of the
power.
<img class="bImg" src="/includes/projects/doorbell/img17.jpg" alt=""></img>
The scope is old and not the most accurate, however it does clearly show the AC sine wave from the bell.
When I add the rectifier into the circuit I get the following:
<img class="bImg" src="/includes/projects/doorbell/img18.jpg" alt=""></img>
The rectifier eliminates the negative voltage, but we still see a drop in voltage, this is because there is
no smoothing, ie the diodes do not hold any charge so the AC pattern slips through. To remove this I added
a smoothing capacitor between the two outputs.
<img class="bImg" src="/includes/projects/doorbell/img19.jpg" alt=""></img>
This plot is not that different from without the capacitor. Therefore one of the issues with my
custom adapter was that I was not using the proper size of capacitor for the system. I also observed that
when I connected my oscilloscope, the light in the doorbell dimmed. This meant that the power across it
decreased which was not expected behavior. The doorbell transformer was not designed for an additional
load such as an oscilloscope or my OLED attachment. These findings are useful because I have learned
more about how residential power works and its related limitations.
<div class="bSub"><p><b>Try, Try Again</b><p /></div>
I ordered a new ESP board from Amazon and decided to abandon the custom power-supply and just use the
manufactor's plug. It looks slightly more messy but it works.
</div>
<!-- Begin Footer $include_path/footer.html -->
<div id="footer">
<br>
[email protected] | MIT license unless otherwise stated
</div>
</div>
<div id="content">
<!-- begin wwww.htmlcommentbox.com -->
<div id="HCB_comment_box"><a href="http://www.htmlcommentbox.com">Comment Box</a> is loading comments...</div>
<script type="text/javascript" id="hcb"> /*<!--*/ if(!window.hcb_user){hcb_user={};} (function(){var s=document.createElement("script"), l=hcb_user.PAGE || (""+window.location).replace(/'/g,"%27"), h="https://www.htmlcommentbox.com";s.setAttribute("type","text/javascript");s.setAttribute("src", h+"/jread?page="+encodeURIComponent(l).replace("+","%2B")+"&mod=%241%24wq1rdBcg%24Xk1c2cCSlprFkr2MjLvTb."+"&opts=16662&num=10&ts=1644780820414");if (typeof s!="undefined") document.getElementsByTagName("head")[0].appendChild(s);})(); /*--!>*/ </script>
<style>
#HCB_comment_box textarea{width:50%;
}
#HCB_comment_box{font-family:arial;color:#FFFFFF;background-color:none;}
#HCB_comment_box p.error{border:1px solid red;background-color:#fee}
.hcb-mod b{color:#d34}
#HCB_comment_box textarea,#hcb_form_name,#HCB_comment_box input.text{border:none;border-radius:5px;background-color:#FFFFFF}
#HCB_comment_box .text-blur {color:none;}
#HCB_comment_box blockquote{background-color:#626262;width:50%;padding:10px;border-radius:5px}
#HCB_comment_box .hcb-wrapper-half{display:block;width:50%;float:left;}
#HCB_comment_box .hcb-wrapper{clear:both}
#HCB_comment_box input.text{display:block;width:75%}
#HCB_comment_box input.submit{border-radius: 20px;;background-color:#626262;color:#FFFFFF;font-weight:700;cursor:pointer}
#HCB_comment_box span.home-desc{font-size:10px;opacity:.4}
.hcb-link{color:white;text-decoration:underline}
.hcb-mod i{color:#00008b}
</style>
<!-- end www.htmlcommentbox.com -->
</div>
</body>
</html>