• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Create a VM ($25 Credit)
  • Buy a Domain
  • 1 Month free Back Blaze Backup
  • Other Deals
    • Domain Email
    • Nixstats Server Monitoring
    • ewww.io Auto WordPress Image Resizing and Acceleration
  • About
  • Links

IoT, Code, Security, Server Stuff etc

Views are my own and not my employer's.

Personal Development Blog...

Coding for fun since 1996, Learn by doing and sharing.

Buy a domain name, then create your own server (get $25 free credit)

View all of my posts.

  • Cloud
    • I moved my domain to UpCloud (on the other side of the world) from Vultr (Sydney) and could not be happier with the performance.
    • How to buy a new domain and SSL cert from NameCheap, a Server from Digital Ocean and configure it.
    • Setting up a Vultr VM and configuring it
    • All Cloud Articles
  • Dev
    • I moved my domain to UpCloud (on the other side of the world) from Vultr (Sydney) and could not be happier with the performance.
    • How to setup pooled MySQL connections in Node JS that don’t disconnect
    • NodeJS code to handle App logins via API (using MySQL connection pools (1000 connections) and query parameters)
    • Infographic: So you have an idea for an app
    • All Development Articles
  • MySQL
    • Using the free Adminer GUI for MySQL on your website
    • All MySQL Articles
  • Perf
    • PHP 7 code to send object oriented sanitised input data via bound parameters to a MYSQL database
    • I moved my domain to UpCloud (on the other side of the world) from Vultr (Sydney) and could not be happier with the performance.
    • Measuring VM performance (CPU, Disk, Latency, Concurrent Users etc) on Ubuntu and comparing Vultr, Digital Ocean and UpCloud – Part 1 of 4
    • Speeding up WordPress with the ewww.io ExactDN CDN and Image Compression Plugin
    • Setting up a website to use Cloudflare on a VM hosted on Vultr and Namecheap
    • All Performance Articles
  • Sec
    • Using the Qualys FreeScan Scanner to test your website for online vulnerabilities
    • Using OWASP ZAP GUI to scan your Applications for security issues
    • Setting up the Debian Kali Linux distro to perform penetration testing of your systems
    • Enabling TLS 1.3 SSL on a NGINX Website (Ubuntu 16.04 server) that is using Cloudflare
    • PHP implementation to check a password exposure level with Troy Hunt’s pwnedpasswords API
    • Setting strong SSL cryptographic protocols and ciphers on Ubuntu and NGINX
    • Securing Google G Suite email by setting up SPF, DKIM and DMARC with Cloudflare
    • All Security Articles
  • Server
    • I moved my domain to UpCloud (on the other side of the world) from Vultr (Sydney) and could not be happier with the performance.
    • All Server Articles
  • Ubuntu
    • I moved my domain to UpCloud (on the other side of the world) from Vultr (Sydney) and could not be happier with the performance.
    • Useful Linux Terminal Commands
    • All Ubuntu Articles
  • VM
    • I moved my domain to UpCloud (on the other side of the world) from Vultr (Sydney) and could not be happier with the performance.
    • All VM Articles
  • WordPress
    • Speeding up WordPress with the ewww.io ExactDN CDN and Image Compression Plugin
    • Installing and managing WordPress with WP-CLI from the command line on Ubuntu
    • How to backup WordPress on a host that has CPanel
    • Moving WordPress to a new self managed server away from CPanel
    • Moving a CPanel domain with email to a self managed VPS and Gmail
    • All WordPress Articles
  • All

Adafruit HUZZAH32 ESP32 Feather + RTC + Alpha-Numeric LED + Solenoid Zen Clock

September 10, 2020 by Simon

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. 

Rough idea of the Zen clock

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.

  1. Adafruit HUZZAH32 – ESP32 Feather Board (pre-soldered)
  2. Adafruit: DS3231 Precision RTC FeatherWing – RTC Add-on For Feather Boards
  3. Adafruit 0.54″ Quad Alphanumeric FeatherWing Display – Green
  4. Particle FeatherWing Trippler
  5. Adafruit Prototyping Add-on Board for Feather
  6. 1x 12 Solenoid (12V 8Amp)
  7. 1x N-CHANNEL MOSFET 60V 30A
  8. Fallback Diode (1N4004 1A 400V Diode – Pack of 4)
  9. Box – Hand Made (TBA)
  10. 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.

Missed soldering on a pin

I had pins that needed touching up as they has too little solder contact

Pin with low contact

After a few touch ups and close inspections I was happy with solder joints.

I am happy with these 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.

Multimeter testing joints

I tripped tested each connection as I did not want issues later.

Multimeter setting

Installing the Arduino IDE Software

On Windows, go to https://www.arduino.cc/en/Main/Software

Download ARDUINO 1.8.13+ (for Windows)

Arduino Website - Download

I Installed the Software

During the setup ensure you install the USB Driver

Install the USB Driver

Also make sure you agree to the device install prompts

  1. Adafruit COM Port

2. Arduino USB Driver(s)

and

Now the Arduino IDE Will be installed

Blank Arduino IDE

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

CP210x Driver

Extract the contents of CP210x_Universal_Windows_Driver.zip

Extract the ZIP FIle

Run CP210xVCPInstaller_x64.exe as Administrator

Run CP210xVCPInstaller_x64.exe as Administrator

I Installed the Drivers

Driver Installed

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

Preferences Screen

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”

Add Boards URL(s)

I closed the Preferences dialogue

I clicked the Tools menu then Boards then Board Manager

Boards Manager

I then search for “esp32”

esp32

I clicked Install

Click the list item then the Install button will appear.

This could take a while,

Installing ESP32 Boards Progress Bar

Installing Boards Progress Bar

Installing Tools 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

Uneatable Combo Box

Always Install the latest version of each library

Some libraries may need dependencies installed (always click “Install All”)

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.

Choose your 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.

Om POrt Inserted

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

Board and Com Port Verify

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

Blink Sketch

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.

Upload Sketch

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

Library Manager

I also need to install the dependencies.

Install Dependancies

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

ds3231 sketch

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.  

Date Output to serial

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

Alpha Numeric Library

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

Filed Under: Arduino, Code, ESP32, IoT Tagged With: Adafruit, ESP32, Featgher, RTC

Advertisement:

Copyright © Fearby.com - Do not copy or duplicate (that means you laptrinhx.com)

Primary Sidebar

Poll

What would you like to see more posts about?
Results

Support this Blog

Create your own server today (support me by using these links

Create your own server on UpCloud here ($25 free credit).

Create your own server on Vultr here.

Create your own server on Digital Ocean here ($10 free credit).

Remember you can install the Runcloud server management dashboard here if you need DevOps help.

Advertisement:

Tags

2FA (9) Advice (17) Analytics (9) App (9) Apple (10) AWS (9) Backup (21) Business (8) CDN (8) Cloud (49) Cloudflare (8) Code (8) Development (26) Digital Ocean (13) DNS (11) Domain (27) Firewall (12) Git (7) Hosting (18) IoT (9) LetsEncrypt (7) Linux (21) Marketing (11) MySQL (24) NGINX (11) NodeJS (11) OS (10) Performance (6) PHP (13) Scalability (12) Scalable (14) Security (45) SEO (7) Server (26) Software (7) SSH (7) ssl (17) Tech Advice (9) Ubuntu (39) Uncategorized (23) UpCloud (12) VM (45) Vultr (24) Website (14) Wordpress (25)

Disclaimer

Terms And Conditions Of Use All content provided on this "www.fearby.com" blog is for informational purposes only. Views are his own and not his employers. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. Never make changes to a live site without backing it up first.

Advertisement:

Footer

Popular

  • Backing up your computer automatically with BackBlaze software (no data limit)
  • How to back up an iPhone (including photos and videos) multiple ways
  • Add two factor auth login protection to WordPress with YubiCo hardware YubiKeys and or 2FA Authenticator App
  • Setup two factor authenticator protection at login on Ubuntu or Debian
  • Using the Yubico YubiKey NEO hardware-based two-factor authentication device to improve authentication and logins to OSX and software
  • I moved my domain to UpCloud (on the other side of the world) from Vultr (Sydney) and could not be happier with the performance.
  • Monitor server performance with NixStats and receive alerts by SMS, Push, Email, Telegram etc
  • Speeding up WordPress with the ewww.io ExactDN CDN and Image Compression Plugin
  • Add Google AdWords to your WordPress blog

Security

  • Check the compatibility of your WordPress theme and plugin code with PHP Compatibility Checker
  • Add two factor auth login protection to WordPress with YubiCo hardware YubiKeys and or 2FA Authenticator App
  • Setup two factor authenticator protection at login on Ubuntu or Debian
  • Using the Yubico YubiKey NEO hardware-based two-factor authentication device to improve authentication and logins to OSX and software
  • Setting up DNSSEC on a Namecheap domain hosted on UpCloud using CloudFlare
  • Set up Feature-Policy, Referrer-Policy and Content Security Policy headers in Nginx
  • Securing Google G Suite email by setting up SPF, DKIM and DMARC with Cloudflare
  • Enabling TLS 1.3 SSL on a NGINX Website (Ubuntu 16.04 server) that is using Cloudflare
  • Using the Qualys FreeScan Scanner to test your website for online vulnerabilities
  • Beyond SSL with Content Security Policy, Public Key Pinning etc
  • Upgraded to Wordfence Premium to get real-time login defence, malware scanner and two-factor authentication for WordPress logins
  • Run an Ubuntu VM system audit with Lynis
  • Securing Ubuntu in the cloud
  • No matter what server-provider you are using I strongly recommend you have a hot spare ready on a different provider

Code

  • How to code PHP on your localhost and deploy to the cloud via SFTP with PHPStorm by Jet Brains
  • Useful Java FX Code I use in a project using IntelliJ IDEA and jdk1.8.0_161.jdk
  • No matter what server-provider you are using I strongly recommend you have a hot spare ready on a different provider
  • How to setup PHP FPM on demand child workers in PHP 7.x to increase website traffic
  • Installing Android Studio 3 and creating your first Kotlin Android App
  • PHP 7 code to send object oriented sanitised input data via bound parameters to a MYSQL database
  • How to use Sublime Text editor locally to edit code files on a remote server via SSH
  • Creating your first Java FX app and using the Gluon Scene Builder in the IntelliJ IDEA IDE
  • Deploying nodejs apps in the background and monitoring them with PM2 from keymetrics.io

Tech

  • Backing up your computer automatically with BackBlaze software (no data limit)
  • How to back up an iPhone (including photos and videos) multiple ways
  • US v Huawei: The battle for 5G
  • Check the compatibility of your WordPress theme and plugin code with PHP Compatibility Checker
  • Is OSX Mojave on a 2014 MacBook Pro slower or faster than High Sierra
  • Telstra promised Fibre to the house (FTTP) when I had FTTN and this is what happened..
  • The case of the overheating Mac Book Pro and Occam’s Razor
  • Useful Linux Terminal Commands
  • Useful OSX Terminal Commands
  • Useful Linux Terminal Commands
  • What is the difference between 2D, 3D, 360 Video, AR, AR2D, AR3D, MR, VR and HR?
  • Application scalability on a budget (my journey)
  • Monitor server performance with NixStats and receive alerts by SMS, Push, Email, Telegram etc
  • Why I will never buy a new Apple Laptop until they fix the hardware cooling issues.

Wordpress

  • Replacing Google Analytics with Piwik/Matomo for a locally hosted privacy focused open source analytics solution
  • Setting web push notifications in WordPress with OneSignal
  • Telstra promised Fibre to the house (FTTP) when I had FTTN and this is what happened..
  • Check the compatibility of your WordPress theme and plugin code with PHP Compatibility Checker
  • Add two factor auth login protection to WordPress with YubiCo hardware YubiKeys and or 2FA Authenticator App
  • Monitor server performance with NixStats and receive alerts by SMS, Push, Email, Telegram etc
  • Upgraded to Wordfence Premium to get real-time login defence, malware scanner and two-factor authentication for WordPress logins
  • Wordfence Security Plugin for WordPress
  • Speeding up WordPress with the ewww.io ExactDN CDN and Image Compression Plugin
  • Installing and managing WordPress with WP-CLI from the command line on Ubuntu
  • Moving WordPress to a new self managed server away from CPanel
  • Moving WordPress to a new self managed server away from CPanel

General

  • Backing up your computer automatically with BackBlaze software (no data limit)
  • How to back up an iPhone (including photos and videos) multiple ways
  • US v Huawei: The battle for 5G
  • Using the WinSCP Client on Windows to transfer files to and from a Linux server over SFTP
  • Connecting to a server via SSH with Putty
  • Setting web push notifications in WordPress with OneSignal
  • Infographic: So you have an idea for an app
  • Restoring lost files on a Windows FAT, FAT32, NTFS or Linux EXT, Linux XFS volume with iRecover from diydatarecovery.nl
  • Building faster web apps with google tools and exceed user expectations
  • Why I will never buy a new Apple Laptop until they fix the hardware cooling issues.
  • Telstra promised Fibre to the house (FTTP) when I had FTTN and this is what happened..

Copyright © 2023 · News Pro on Genesis Framework · WordPress · Log in

Some ads on this site use cookies. You can opt-out if of local analytics tracking by scrolling to the bottom of the front page or any article and clicking "You are not opted out. Click here to opt out.". Accept Reject Read More
GDPR, Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT