|
FirebeetleDFRobot
|
x 1 | |
|
Robot accessory SG90 steering gear(360°/ Rotation control) |
x 1 | |
|
3 Watt 4 Ohm SpeakerAdafruit
|
x 1 | |
|
HW104 3 watts amp |
x 1 |
|
Autodesk Fusion 360Autodesk
|
|
|
arduino IDEArduino
|
Vespa Diorama ESP32 NTP clock
I love Italian motorcycles. I have a Ducati, I’ve rided a Guzzi to travel around Europe and I even founded with some friends a classic Gilera Motorcycle club in Argentina. Of course there is no way to avoid the Vespa. There is something about the design, the use of “hacked” parts, the style and the allure. So I’ve decided to make a small Vespa diorama clock. Diorama clock? It is a Diorama, since ir represents a 76 Vespa Primavera ignition in a bucolic scenario. But is also a clock since the Vespa engine starts every other hour like a cuckoo clock asking NTP server through WiFi.
How does it work? It is based in Fireebeetle, an advanced and powerful ESP compatible board made by DfRobot. The board is connected to the WiFi router in order to ask NTP server. Whenever a new hour starts, a .wav is played without any external module but a small amplifier. Also an SG90 servo moves the front wheel. The entire device is mounted over a custom made 3d printed base.
How to check the hour using NTP server
NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds);
Off set for Buenos Aires is calculated with:
const long utcOffsetInSeconds = -10800; // -3 GMT x 60 x 60
timeClient.begin();
Inside the loop
timeClient.update();
Serial.print(timeClient.getHours());
Serial.print(":");
Serial.print(timeClient.getMinutes());
if (timeClient.getMinutes()==0){
Serial.print("Hour changed, start Diorama");
...
} // 0 minutes
How to move the servo
It is better to use a 360 degree servo so you can get continuous wheel movement but since I only had at hand a regular servo, I go forward 180 degrees and then backward slowly those 180 degrees.
int posDegrees=180;
// forward
while (posDegrees>=0)
{
servo1.write(posDegrees);
posDegrees--;
delay(20);
}
How to play sounds in ESP 32
This is the only tricky part of this project. I usually use DFRobot Player Mini to play sounds but ESP boards and DfPlayer mini do not get along well due to serial libraries issues. I’ve decided to play a wav file, converted to hexa without any external hardware. The sound comes out from standard Fireebeetle pin. Then I use a cheap 3W amplifier and a speaker.
First step is to get a wav file. You can use something like https://x2download.com/en52 to get an audio from a YouTube video.
Then you can use free Audacity to cut the file and convert to WAV. File should be small to fit ESP RAM so change Project Rate 8000Hz. Then Export as Unsigned 8 bit PCM.
Now you have to open the file with Hex editor like https://mh-nexus.de/en/hxd/ Open the wav, Ctrl + A, then Edit Copy as C into a text file named vespa.h
Install XT_DAC_Audio.h library into Arduino IDE. Then use this code:
#include "vespa.h"
#include "XT_DAC_Audio.h"
XT_Wav_Class Sound(sample);
XT_DAC_Audio_Class DacAudio(25,0);
uint32_t DemoCounter=0;
void setup() {
Serial.begin(115200);
}
void loop() {
DacAudio.FillBuffer();
if(Sound.Playing==false)
DacAudio.Play(&Sound);
}
Vespa Diorama ESP32 NTP clock
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Roni Bandini
- Swatch Retro Internet Time Clock with Xiao TFT Round Display Internet Time is a decimal time concept released in 1998 by the Swatch corporation. Instead of hours...
- Joule Thief Components:Ferrite torroid (You can make one with an old low consumption Lamp and 2 copper wires)1k ...
- Fall Detection client-server system with Machine Learning Falls could be dangerous in any situation but for certain working scenarios, consequences are defini...
- Bhopal 84, detect harmful gases with machine learning and Arduino Industries working with chemicals are always subject to leaks that could harm workers. Sometimes tho...
- Ibarrola, anti facial recognition servo glasses These are simple servo glasses designed to fool facial recognition software with manual and automati...
- Bitcoin ring with Attiny85 I’ve started to think about a project that could take advantage of DigiSpark board features (reduced...
- Dry Martini WiFi operated neon led sign English CC captions availableI like Dry Martinis. Maybe due to the cocktail glass design or to the f...
- Vespa Diorama ESP32 NTP clock I love Italian motorcycles. I have a Ducati, I’ve rided a Guzzi to travel around Europe and I even f...
-
-
-
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
154 1 1 -
-