This IoT project is under construction.
My goal is to have a Microcontroller strike a Singbowl (I purchased from https://singbowls.com/) every hour between 7AM and 9PM (every day) to remind my kids to be more mindful and stay in the present moment. I had a minor stroke 3 years ago and I can tell you that mindfulness is very important.
The Microcontroller I will use is an ESP-32 running off 5 volts (DC) that will have a solid-state real-time clock and each hour a solenoid will be activated and strike the sing bowl (making a nice noise)
Extra strikes will wake the kids up on school mornings and at their bedtime.
Disclaimer: I am not a qualified electrician or electronics expert. All advice is given “as is” and without guarantees or defects. In software coding or electronics there is always edge cases and limits of code or circuits. I did not get a discount for the Sing bowl to promote them and this is not a plug for Adafruit.
Why?
Ever since I pulled apart my first remote control Christmas toy at 10 years old I have been fascinated with Electronics. At 14 year old, I became fascinated with Computer Games and at 16 years old I became fascinated with computer programming.
40 years later (almost 25-year’s working as a software engineer/programming) I now have time to return to a childhood passion and discover electronic circuits are and how to make them.
Better still I can control the circuits with computer code.
Sing Bowl Sound
Here is a video recording of the sound of the Sing bowl before purchased it (video kindly made by Anup before purchase). Thanks, Anup for answering my silly questions.
I am calling it a Zen bowl as my Kids know Zen. Apologies Anup.
I found Anup and https://singbowls.com/ by searching YouTube one night and I found this 9-year-old video.
Parts
Below are parts I am using.
- Adafruit HUZZAH32 – ESP32 Feather Board (pre-soldered)
- Adafruit: DS3231 Precision RTC FeatherWing – RTC Add-on For Feather Boards
- Adafruit 0.54″ Quad Alphanumeric FeatherWing Display – Green
- Particle FeatherWing Trippler
- Adafruit Prototyping Add-on Board for Feather
- 1x 12 Solenoid (12V 8Amp)
- 1x N-CHANNEL MOSFET 60V 30A
- Fallback Diode (1N4004 1A 400V Diode – Pack of 4)
- Box – Hand Made (TBA)
- Resistors, LEDs, Headers, Buttons (TBA)
I have ordered the bulk of the parts from Australia (e.g https://core-electronics.com.au/). Core Electronics are awesome as they have great chat support on their website and answer silly questions from me.
Pre Assembled v Soldering
You may be able to buy all pre-assembled parts or you can solder the parts where needed. I have a cheap Soldering iron from Jaycar.
I decided to solder the Clock and Display but not the ESP-32. I used Lead-free solder and Rosin flux.
Soldering can be fun but with you need good close up vision or you miss pins like me.
I had pins that needed touching up as they has too little solder contact
After a few touch ups and close inspections I was happy with solder joints.
All feather boards fit the tripper board after 100 odd solder connections (including the screen joints not pictured)
After solder joints were made and I cleaned them up with pure Isopropyl Alcohol I tested each joint with my multimeter to ensure each joint was not connected to nearby joints.
I tripped tested each connection as I did not want issues later.
Installing the Arduino IDE Software
On Windows, go to https://www.arduino.cc/en/Main/Software
Download ARDUINO 1.8.13+ (for Windows)
I Installed the Software
During the setup ensure you install the USB Driver
Also make sure you agree to the device install prompts
- Adafruit COM Port
2. Arduino USB Driver(s)
and
Now the Arduino IDE Will be installed
Installing the Adafruit SiLabs CP2104 Driver
I need to install the SiLabs CP2104 Driver.
This can be obtained from the Adafruit website here (https://learn.adafruit.com/adafruit-huzzah32-esp32-feather/using-with-arduino-ide).
This redirects to here: https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
Download the “Windows 10 Universal – VCP Software): CP210x_Universal_Windows_Driver.zip
Extract the contents of CP210x_Universal_Windows_Driver.zip
Run CP210xVCPInstaller_x64.exe as Administrator
I Installed the Drivers
Installing the Adafruit ESP Feather in the Arduino IDE Boards Manager
The Espressif Arduino GitHub repository details how you can add the EBS32boards to the Arduino Boards Manager. Scroll down to “Installation Instructions”
Go to https://github.com/espressif/arduino-esp32#using-through-arduino-ide
Open the Arduino IDE Application and click File then Preferences
I will follow the steps here https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/boards_manager.md
Under “Additional Boards Manager URL: Add “https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json”
I closed the Preferences dialogue
I clicked the Tools menu then Boards then Board Manager
I then search for “esp32”
I clicked Install
This could take a while,
Installing ESP32 Boards Progress Bar
Installing Tools Progress Bar
Updating Libraries
From time to time (if the Arduino IDE does not prompt you) you may need to open the Library Manager and check for updatable libraries to download
Always Install the latest version of each library
Some libraries may need dependencies installed (always click “Install All”)
Selecting the Adafruit Feather in the Arduino IDE
In the Arduino IDE, I went to the Tools Menu then Board the ESP-32 Arduino then select Adafruit Feather ESP-32 Feather to choose that board.
I will need to also define the COM port that the ESP-32 is using. I do that by opening Computer Management/Device Manager on Windows and expand the Ports (COM & LPT), plug in the ESP-32 and see what COM port appears.
Then I can set that COM port in the Arduino IDE.
In the bottom right of the Arduino IDE confirm that your ESP-32 and COM port match
Writing your first sketch to the ESP32
To ensure the soldering is OK and that the Arduino IDE is OK and connection to the board let’s use a simple sketch to replace the default blink sketch.
In the Arduino IDE click the File menu then Examples then 01.Basic then Blink
Code
/*
Blink
Turns an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino
model, check the Technical Specs of your board at:
https://www.arduino.cc/en/Main/Products
modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Blink
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
I changed the first 1000 in the loop to 5000 to make the blink slower than the one from the factory on the board.
Click the Verify then Upload button to confirm you can write to the ESP-32.
Adding the DS3231 Precision RTC Library to the Arduino IDE
Read here to learn about the DS3231 RTC https://learn.adafruit.com/ds3231-precision-rtc-featherwing
I just need to add a CR1220 3v Battery. One battery should last about 5 years.
Only 4 pins (https://learn.adafruit.com/ds3231-precision-rtc-featherwing/pinouts) are used to communicate with the ESP32
I can use the Arduino Library manager to find the RTCLib library
I also need to install the dependencies.
Connecting the DS3231 Precision RTC Library to the ESP32
I connected the RTC Feather to the EBS-32.
Now I can open the example ds3231 sketch and write it to the ESP-32.
In the Arduino IDE click the File menu then Examples then RTCLib then ds3231
Code
// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
#include "RTClib.h"
RTC_DS3231 rtc;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
void setup () {
Serial.begin(57600);
#ifndef ESP8266
while (!Serial); // wait for serial port to connect. Needed for native USB
#endif
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
abort();
}
if (rtc.lostPower()) {
Serial.println("RTC lost power, let's set the time!");
// When time needs to be set on a new device, or after a power loss, the
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
// When time needs to be re-set on a previously configured device, the
// following line sets the RTC to the date & time this sketch was compiled
// rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
void loop () {
DateTime now = rtc.now();
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(" (");
Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
Serial.print(") ");
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
Serial.print(" since midnight 1/1/1970 = ");
Serial.print(now.unixtime());
Serial.print("s = ");
Serial.print(now.unixtime() / 86400L);
Serial.println("d");
// calculate a date which is 7 days and 30 seconds into the future
DateTime future (now + TimeSpan(7,12,30,6));
Serial.print(" now + 7d + 30s: ");
Serial.print(future.year(), DEC);
Serial.print('/');
Serial.print(future.month(), DEC);
Serial.print('/');
Serial.print(future.day(), DEC);
Serial.print(' ');
Serial.print(future.hour(), DEC);
Serial.print(':');
Serial.print(future.minute(), DEC);
Serial.print(':');
Serial.print(future.second(), DEC);
Serial.println();
Serial.print("Temperature: ");
Serial.print(rtc.getTemperature());
Serial.println(" C");
Serial.println();
delay(3000);
}
After flashing the ESP-32 I could see the ESP-32 was sending back data from the Microcontroller.
Adding the QUAD Alphanumeric Feather Wing Display to the Arduino IDE
The Alpha-Numeric display is a more complex so time to read some documentation.
- Product Page: https://learn.adafruit.com/14-segment-alpha-numeric-led-featherwing
- Pinouts: https://learn.adafruit.com/14-segment-alpha-numeric-led-featherwing/pinouts
- Assembly: https://learn.adafruit.com/14-segment-alpha-numeric-led-featherwing/assembly
- Usage: https://learn.adafruit.com/14-segment-alpha-numeric-led-featherwing/usage
I can download the library to drive this display here: https://github.com/adafruit/Adafruit_LED_Backpack/archive/master.zip
I downloaded the library.
Snip “Rename the uncompressed folder Adafruit_LEDBackpack. Check that the Adafruit_LEDBackpack folder contains Adafruit_LEDBackpack.cpp and Adafruit_LEDBackpack.h Place the Adafruit_LEDBackpack library folder your arduinosketchfolder/libraries/ folder.”
Library Manager: https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use/library-manager
Testing the QUAD Alphanumeric Feather Wing Display to the ESP32
In the Arduino IDE click the File menu then Examples then Adafruit LED Backpack Library then quadalphanum
I connected the Alpha Numeric Display to the EPS-32 and uploaded the sketch.
Code
// Demo the quad alphanumeric display LED backpack kit
// scrolls through every character, then scrolls Serial
// input onto the display
#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4();
void setup() {
Serial.begin(9600);
alpha4.begin(0x70); // pass in the address
alpha4.writeDigitRaw(3, 0x0);
alpha4.writeDigitRaw(0, 0xFFFF);
alpha4.writeDisplay();
delay(200);
alpha4.writeDigitRaw(0, 0x0);
alpha4.writeDigitRaw(1, 0xFFFF);
alpha4.writeDisplay();
delay(200);
alpha4.writeDigitRaw(1, 0x0);
alpha4.writeDigitRaw(2, 0xFFFF);
alpha4.writeDisplay();
delay(200);
alpha4.writeDigitRaw(2, 0x0);
alpha4.writeDigitRaw(3, 0xFFFF);
alpha4.writeDisplay();
delay(200);
alpha4.clear();
alpha4.writeDisplay();
// display every character,
for (uint8_t i='!'; i<='z'; i++) {
alpha4.writeDigitAscii(0, i);
alpha4.writeDigitAscii(1, i+1);
alpha4.writeDigitAscii(2, i+2);
alpha4.writeDigitAscii(3, i+3);
alpha4.writeDisplay();
delay(300);
}
Serial.println("Start typing to display!");
}
char displaybuffer[4] = {' ', ' ', ' ', ' '};
void loop() {
while (! Serial.available()) return;
char c = Serial.read();
if (! isprint(c)) return; // only printable!
// scroll down display
displaybuffer[0] = displaybuffer[1];
displaybuffer[1] = displaybuffer[2];
displaybuffer[2] = displaybuffer[3];
displaybuffer[3] = c;
// set every digit to the buffer
alpha4.writeDigitAscii(0, displaybuffer[0]);
alpha4.writeDigitAscii(1, displaybuffer[1]);
alpha4.writeDigitAscii(2, displaybuffer[2]);
alpha4.writeDigitAscii(3, displaybuffer[3]);
// write it out!
alpha4.writeDisplay();
delay(200);
}
It worked
Combining the Blink + Clock+ Alphanumeric Display into Ome Sketch
Now I can combine all sketches into one and have the Alpha Numeric display the time
Code
// Simon Fearby - 10th Sep 2020
// Alpha Numeric Screen Setup
#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
Adafruit_AlphaNum4 greenScreen = Adafruit_AlphaNum4();
//RTC Setup
#include "RTClib.h"
RTC_DS3231 rtc;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
void setup() {
//Serial.begin(9600);
Serial.begin(57600);
//Alpha Num Setup
greenScreen.begin(0x70); // pass in the address
//15 is Highest Brightness
//0 is Lowest Brightness
greenScreen.setBrightness(7);
greenScreen.clear();
//RTC Setup
#ifndef ESP8266
while (!Serial); // wait for serial port to connect. Needed for native USB
#endif
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
abort();
}
if (rtc.lostPower()) {
Serial.println("RTC lost power, let's set the time!");
// When time needs to be set on a new device, or after a power loss, the
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
// When time needs to be re-set on a previously configured device, the
// following line sets the RTC to the date & time this sketch was compiled
// rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
// Blink Setup
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
//Led
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
//RTC
DateTime now = rtc.now();
Serial.print(now.day(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.year(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.print(" (");
Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
Serial.print(") ");
Serial.println();
/*
Serial.print(" since midnight 1/1/1970 = ");
Serial.print(now.unixtime());
Serial.print("s = ");
Serial.print(now.unixtime() / 86400L);
Serial.println("d");
// calculate a date which is 7 days and 30 seconds into the future
DateTime future (now + TimeSpan(7,12,30,6));
Serial.print(" now + 7d + 30s: ");
Serial.print(future.year(), DEC);
Serial.print('/');
Serial.print(future.month(), DEC);
Serial.print('/');
Serial.print(future.day(), DEC);
Serial.print(' ');
Serial.print(future.hour(), DEC);
Serial.print(':');
Serial.print(future.minute(), DEC);
Serial.print(':');
Serial.print(future.second(), DEC);
Serial.println();
*/
//Default display
greenScreen.writeDigitAscii(0, '0');
greenScreen.writeDigitAscii(1, '0');
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '0');
//Hour
switch (now.hour()) {
case 0:
greenScreen.writeDigitAscii(0, '1');
greenScreen.writeDigitAscii(1, '2');
break;
case 1:
greenScreen.writeDigitAscii(0, '0');
greenScreen.writeDigitAscii(1, '1');
break;
case 2:
greenScreen.writeDigitAscii(0, '0');
greenScreen.writeDigitAscii(1, '2');
break;
case 3:
greenScreen.writeDigitAscii(0, '0');
greenScreen.writeDigitAscii(1, '3');
break;
case 4:
greenScreen.writeDigitAscii(0, '0');
greenScreen.writeDigitAscii(1, '4');
break;
case 5:
greenScreen.writeDigitAscii(0, '0');
greenScreen.writeDigitAscii(1, '5');
break;
case 6:
greenScreen.writeDigitAscii(0, '0');
greenScreen.writeDigitAscii(1, '6');
break;
case 7:
greenScreen.writeDigitAscii(0, '0');
greenScreen.writeDigitAscii(1, '7');
break;
case 8:
greenScreen.writeDigitAscii(0, '0');
greenScreen.writeDigitAscii(1, '8');
break;
case 9:
greenScreen.writeDigitAscii(0, '0');
greenScreen.writeDigitAscii(1, '9');
break;
case 10:
greenScreen.writeDigitAscii(0, '1');
greenScreen.writeDigitAscii(1, '0');
break;
case 11:
greenScreen.writeDigitAscii(0, '1');
greenScreen.writeDigitAscii(1, '1');
break;
case 12:
greenScreen.writeDigitAscii(0, '1');
greenScreen.writeDigitAscii(1, '2');
break;
case 13:
greenScreen.writeDigitAscii(0, '1');
greenScreen.writeDigitAscii(1, '3');
break;
case 14:
greenScreen.writeDigitAscii(0, '1');
greenScreen.writeDigitAscii(1, '4');
break;
case 15:
greenScreen.writeDigitAscii(0, '1');
greenScreen.writeDigitAscii(1, '5');
break;
case 16:
greenScreen.writeDigitAscii(0, '1');
greenScreen.writeDigitAscii(1, '6');
break;
case 17:
greenScreen.writeDigitAscii(0, '1');
greenScreen.writeDigitAscii(1, '7');
break;
case 18:
greenScreen.writeDigitAscii(0, '1');
greenScreen.writeDigitAscii(1, '8');
break;
case 19:
greenScreen.writeDigitAscii(0, '1');
greenScreen.writeDigitAscii(1, '9');
break;
case 20:
greenScreen.writeDigitAscii(0, '2');
greenScreen.writeDigitAscii(1, '0');
break;
case 21:
greenScreen.writeDigitAscii(0, '2');
greenScreen.writeDigitAscii(1, '1');
break;
case 22:
greenScreen.writeDigitAscii(0, '2');
greenScreen.writeDigitAscii(1, '2');
break;
case 23:
greenScreen.writeDigitAscii(0, '2');
greenScreen.writeDigitAscii(1, '3');
break;
case 24:
greenScreen.writeDigitAscii(0, '2');
greenScreen.writeDigitAscii(1, '4');
break;
default:
greenScreen.writeDigitAscii(0, '0');
greenScreen.writeDigitAscii(1, '0');
break;
}
//Minute
switch (now.minute()) {
case 0:
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '0');
break;
case 1:
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '1');
break;
case 2:
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '2');
break;
case 3:
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '3');
break;
case 4:
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '4');
break;
case 5:
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '5');
break;
case 6:
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '6');
break;
case 7:
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '7');
break;
case 8:
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '8');
break;
case 9:
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '9');
break;
case 10:
greenScreen.writeDigitAscii(2, '1');
greenScreen.writeDigitAscii(3, '0');
break;
case 11:
greenScreen.writeDigitAscii(2, '1');
greenScreen.writeDigitAscii(3, '1');
break;
case 12:
greenScreen.writeDigitAscii(2, '1');
greenScreen.writeDigitAscii(3, '2');
break;
case 13:
greenScreen.writeDigitAscii(2, '1');
greenScreen.writeDigitAscii(3, '3');
break;
case 14:
greenScreen.writeDigitAscii(2, '1');
greenScreen.writeDigitAscii(3, '4');
break;
case 15:
greenScreen.writeDigitAscii(2, '1');
greenScreen.writeDigitAscii(3, '5');
break;
case 16:
greenScreen.writeDigitAscii(2, '1');
greenScreen.writeDigitAscii(3, '6');
break;
case 17:
greenScreen.writeDigitAscii(2, '1');
greenScreen.writeDigitAscii(3, '7');
break;
case 18:
greenScreen.writeDigitAscii(2, '1');
greenScreen.writeDigitAscii(3, '8');
break;
case 19:
greenScreen.writeDigitAscii(2, '1');
greenScreen.writeDigitAscii(3, '9');
break;
case 20:
greenScreen.writeDigitAscii(2, '2');
greenScreen.writeDigitAscii(3, '0');
break;
case 21:
greenScreen.writeDigitAscii(2, '2');
greenScreen.writeDigitAscii(3, '1');
break;
case 22:
greenScreen.writeDigitAscii(2, '2');
greenScreen.writeDigitAscii(3, '2');
break;
case 23:
greenScreen.writeDigitAscii(2, '2');
greenScreen.writeDigitAscii(3, '3');
break;
case 24:
greenScreen.writeDigitAscii(2, '2');
greenScreen.writeDigitAscii(3, '4');
break;
case 25:
greenScreen.writeDigitAscii(2, '2');
greenScreen.writeDigitAscii(3, '5');
break;
case 26:
greenScreen.writeDigitAscii(2, '2');
greenScreen.writeDigitAscii(3, '6');
break;
case 27:
greenScreen.writeDigitAscii(2, '2');
greenScreen.writeDigitAscii(3, '7');
break;
case 28:
greenScreen.writeDigitAscii(2, '2');
greenScreen.writeDigitAscii(3, '8');
break;
case 29:
greenScreen.writeDigitAscii(2, '2');
greenScreen.writeDigitAscii(3, '9');
break;
case 30:
greenScreen.writeDigitAscii(2, '3');
greenScreen.writeDigitAscii(3, '0');
break;
case 31:
greenScreen.writeDigitAscii(2, '3');
greenScreen.writeDigitAscii(3, '1');
break;
case 32:
greenScreen.writeDigitAscii(2, '3');
greenScreen.writeDigitAscii(3, '2');
break;
case 33:
greenScreen.writeDigitAscii(2, '3');
greenScreen.writeDigitAscii(3, '3');
break;
case 34:
greenScreen.writeDigitAscii(2, '3');
greenScreen.writeDigitAscii(3, '4');
break;
case 35:
greenScreen.writeDigitAscii(2, '3');
greenScreen.writeDigitAscii(3, '5');
break;
case 36:
greenScreen.writeDigitAscii(2, '3');
greenScreen.writeDigitAscii(3, '6');
break;
case 37:
greenScreen.writeDigitAscii(2, '3');
greenScreen.writeDigitAscii(3, '7');
break;
case 38:
greenScreen.writeDigitAscii(2, '3');
greenScreen.writeDigitAscii(3, '8');
break;
case 39:
greenScreen.writeDigitAscii(2, '3');
greenScreen.writeDigitAscii(3, '9');
break;
case 40:
greenScreen.writeDigitAscii(2, '4');
greenScreen.writeDigitAscii(3, '0');
break;
case 41:
greenScreen.writeDigitAscii(2, '4');
greenScreen.writeDigitAscii(3, '1');
break;
case 42:
greenScreen.writeDigitAscii(2, '4');
greenScreen.writeDigitAscii(3, '2');
break;
case 43:
greenScreen.writeDigitAscii(2, '4');
greenScreen.writeDigitAscii(3, '3');
break;
case 44:
greenScreen.writeDigitAscii(2, '4');
greenScreen.writeDigitAscii(3, '4');
break;
case 45:
greenScreen.writeDigitAscii(2, '4');
greenScreen.writeDigitAscii(3, '5');
break;
case 46:
greenScreen.writeDigitAscii(2, '4');
greenScreen.writeDigitAscii(3, '6');
break;
case 47:
greenScreen.writeDigitAscii(2, '4');
greenScreen.writeDigitAscii(3, '7');
break;
case 48:
greenScreen.writeDigitAscii(2, '4');
greenScreen.writeDigitAscii(3, '8');
break;
case 49:
greenScreen.writeDigitAscii(2, '4');
greenScreen.writeDigitAscii(3, '9');
break;
case 50:
greenScreen.writeDigitAscii(2, '5');
greenScreen.writeDigitAscii(3, '0');
break;
case 51:
greenScreen.writeDigitAscii(2, '5');
greenScreen.writeDigitAscii(3, '1');
break;
case 52:
greenScreen.writeDigitAscii(2, '5');
greenScreen.writeDigitAscii(3, '2');
break;
case 53:
greenScreen.writeDigitAscii(2, '5');
greenScreen.writeDigitAscii(3, '2');
break;
case 54:
greenScreen.writeDigitAscii(2, '5');
greenScreen.writeDigitAscii(3, '4');
break;
case 55:
greenScreen.writeDigitAscii(2, '5');
greenScreen.writeDigitAscii(3, '5');
break;
case 56:
greenScreen.writeDigitAscii(2, '5');
greenScreen.writeDigitAscii(3, '6');
break;
case 57:
greenScreen.writeDigitAscii(2, '5');
greenScreen.writeDigitAscii(3, '7');
break;
case 58:
greenScreen.writeDigitAscii(2, '5');
greenScreen.writeDigitAscii(3, '8');
break;
case 59:
greenScreen.writeDigitAscii(2, '5');
greenScreen.writeDigitAscii(3, '9');
break;
default:
greenScreen.writeDigitAscii(2, '0');
greenScreen.writeDigitAscii(3, '0');
break;
}
greenScreen.writeDisplay();
//Serial.print("Temperature: ");
//Serial.print(rtc.getTemperature());
//Serial.println(" C");
//Serial.println();
delay(800);
}
Video
Triggering a Solenoid Every Hour and making a sound
I have created a test circuit to test the MOSFET (first with a 12V motor then a solenoid), I am using the Fritzing program to create the circuit.
Apologies the 12V power source is shown as AA- batteries this is because I can’t find the right Fritzinbg part to indicate a DC power
Here is the Arduino IDE code to drive the motor
int led = 13; //Define the onboard LED
PIN
int mosfet = 5; //Define the MOSFET Trigger
PIN
void setup() {
pinMode(led, OUTPUT);
pinMode(mosfet, OUTPUT);
}
void loop() {
//Turn ON the LED
digitalWrite(led, HIGH);
//Turn ON the MOSFET
digitalWrite(mosfet, HIGH);
//Wait half 3 seconds
delay(3000);
//Turn OFF the LED
digitalWrite(led, LOW);
//Turn OFF the MOSFET
digitalWrite(mosfet, LOW);
//Wait 3 Seconds
delay(3000);
//Loop
}
Here is a video of this circuit working
I will eventually move this over to my in progress ESP-32 Micro Controller.
When I move to the Solenoid (12v 8 A) I will need to turn on the Solenoid for mo more than a second
//Turn ON the MOSFET
digitalWrite(mosfet, HIGH);
//Wait a half a seconds
delay(500);
Power Usage
Power usage is low and Micro Controller, Clock and Display only used 0.048A, there is still room to make this microcontroller use less power.
My Wireless Completer Headphones Dongle I use on my PC uses 0.07A
Safety Features
Safety features are in progress.
- Fuse for power protection
- Multiple Thermistor’s to sense the temperature of the Solenoid
- Heatsink for the MOSFET
- etc TBA
Where I purchased Parts from in Australia
This is not a plug of affiliate links.
- Adafruit HUZZAH32 – ESP32 Feather Board (pre-soldered)
- Adafruit: DS3231 Precision RTC FeatherWing – RTC Add-on For Feather Boards
- Particle FeatherWing Trippler
- Adafruit 0.54″ Quad Alphanumeric FeatherWing Display – Green
- Adafruit Prototyping Add-on Board for Feather
- 1x 12 Solenoid (12V 8Amp)
- 1x N-CHANNEL MOSFET 60V 30A
- Fallback Diode (1N4004 1A 400V Diode – Pack of 4)
- Thermistors
- Box (Tba)
- TBA: Resistors, LEDS, Headers
Links
- https://singbowls.com/
- Adafruit HUZZAH32 – ESP32 Feather Related
- Overview: https://learn.adafruit.com/adafruit-huzzah32-esp32-feather
- Pinout: https://learn.adafruit.com/adafruit-huzzah32-esp32-feather/pinouts
- Assembly: https://learn.adafruit.com/adafruit-huzzah32-esp32-feather/assembly
- Power: https://learn.adafruit.com/adafruit-huzzah32-esp32-feather/power-management
- IDE: https://learn.adafruit.com/adafruit-huzzah32-esp32-feather/using-with-arduino-ide
v1.2 Added Prototype Wiring Diagrams and safety features