ESP8266-01 WIFI MUSICAL BELL WITH LED

by Cathode_Ray in Circuits > Arduino

818 Views, 0 Favorites, 0 Comments

ESP8266-01 WIFI MUSICAL BELL WITH LED

IMG_0505.JPG
IMG_0507.JPG
ESP8266-01 PINOUT.PNG

This project came about from the purchase of a batch of ESP8266-01 variety chips.
These are the little boards with 8 pins and a limited output in terms of GP I/O in fact most times it gets quoted that they only have one I/O. That statement is incorrect of course as they actually have 4 pins you can use although they are multi function so you have to be careful how you use them.

Two are serial pins RX/TX for the serial out for debugging purposes . I'll not use these here as I want to debug in real time, I am really interested in pins 3 and 5. 3 is always available as GPI-02 and 5 as GPI-00.

We can look at the code later and do some walkthroughs, however its prudent to mention that these little boards have to be programmed by pulling the reset line down and then holding pin 5 low to allow the reset to go high.
This gets you into programme mode. There is a wealth of information on this so I wont repeat it here.

Power wise I have opted for using the USB connector as a purveyor of juice, or ergs if you prefer.
You will notice I am using an HBLED as an indicator of the bell ringing for the hard of hearing.

So what does this do:
The idea is to set the board up as a wireless access point that is discoverable by WIFI and once connected will give you a button to press to ring the bell and to flash a LED.

I have opted for 10 secs but again is configurable or you can get clever with the callbacks[Ticker] to fire some more events. This device is not large so its limited but its cheap!! If you don't need to do much this is the kiddy.
A lot of the functionality in code is default such as ip address etc but its all configurable to what you want of course.
Check out my video describing the operation.

https://youtu.be/cAUYztMnS30

What You Will Need

BOMBELL.PNG

Some Comments on the list

BT66 This is a sound IC with many pre programmed songs.

Speaker listed as AST-030COMR-R. I measured this as 80 ohms.

Transistor listed as BC547 is actually a BC237A

Resistor in LED DRIVER LOAD IS 1 OHM. 2N7000 fet has a drain source resistance as 5 or 6 ohms.

First the Schematic

ast.PNG

I attach the schematic in pdf form.
Lets go through this;

USB port is purely for power. D+ and D- are unused. 5V routed to U1 which is the voltage regulator.
Usual decoupling around the package.3.3V fed to ESP-0! WIFI 8 PIN device. Pull ups on pins 4 and 6.
I also added a pull up on pin 5 the programming pin which has an o/p routed through R6 to the gate of the FET.
The drain of the FET has the HBLED and a 1 ohm resistor fed from the 5V line direct. The 1 ohm resistor in conjunction with the drain source resistance limits the drain current and therefore current through the LED to approx. 200mA...its bright. This will be programmed to flash the LED using an event counter in Ticker.

Pin 3 from the ESP drives the sound chip BT66 through a 220 ohm resistor to pin 2. Pin 1 is its o/p which exits through another 220 ohm resistor to the base of the BC237A. The impedance shifter of Q1 couples the o/p to SP1 the speaker which has an impedance of approx. 80 ohms. There is no gain here in the emitter of Q1 but we do get some current gain of approx. 100 in this common emitter configuration. If we do the math then we should get about 0.1 mW or approx 10db of SPL which is adequate but not too loud. See AST-030COMR Farnell components.

Some additional notes. The linear LDO regulator is 800mA capable. You could make this smaller as the only 3.3V load is the sound chip and the ESP chip. I will leave that to the more enterprising, for me it was in my box!

THE CODE

Lets go through this as well.
For those familiar with the Arduino

<blockquote><br></blockquote>Note the inclusion of the ticker scheduler
NOTE THAT WE DECLARE 2 INSTANCES OF TICKER TIMERS -----> TickerScheduler ts(2);
The pins that will be used are LED_BUILTIN and a previous declare of LED_Pin

Then we have the password and the SSID that the device will be seen as when you browse.
Then we have a couple of functions which will get called by the ticker routine.

Lets jump to the setup.
we use pinmode(name of pin,I/O) to set them up.
Then we pass in the parameters to the async call backs for each of the two timers.
<p>ts.add(params). We pass in callback funcs etc.

In the main first thing we do is service the ticker scheduler.
then we check for clients and return if no connection.
If a client has connected then we get the string and see if it says bellON
Then we o/p the HTML which is in some strings.
Study the HTML strings and put in your version of the buttons.<br>You can customise to what you want, bear in mind that the ESP is somewhat limited for storage. 
</p>






<br>