Bluetooth Speaker + Clock + Environment Monitor

by haroldspudovich in Circuits > Speakers

244 Views, 1 Favorites, 0 Comments

Bluetooth Speaker + Clock + Environment Monitor

IMG_20231230_104150606.jpg
IMG_20230803_160014524.jpg
IMG_20231217_211057634.jpg
IMG_20231216_143451889.jpg

This project builds a fine looking bluetooth speaker powered by 26650 LiPo batteries. As an extra bolt-on (!) I decided to add a clock and temp/humidity sensor to it using an ESP32 microcontroller. It's all programmed in (micro)Python and the code is included. Originally I wanted a clock time-sync'ed to the UK atomic clock using a 60KHz receiver, but alas the microcontroller is too noisy with stray EM radiation, so I've used internet NTP time to set the clock upon power on.

The speaker is a tiny 2" Monacor drive unit within a tuned ported enclosure to help it make some bass; it also has a bass-boost analogue circuit to help it a bit more! Seems to work well and sounds really quite good for the size.

The clock uses wifi to get its date-time information; if it doesn't manage to get data then it falls back to its internal Real Time Clock Module, which is updated every time we do get a time sync signal.



Supplies

IMG_20230803_160038185.jpg
IMG_20230805_162345344.jpg
IMG_20231125_122759624.jpg

You will need :

  1. Timber of your choice. I used Sapele. see below.
  2. Solid Sapele Mahogany Hardwood Timber - Kiln Dried 1.5 m x 145mm x 12mm £26.55
  3. ESP32 WROOM . About £6 ish.
  4. DS1302 Real time Clock module with Lipo coin battery.
  5. 4 x 26650 Lipo batteries and two twin battery holders. see below.
  6. 4 x SKYWOLFEYE 26650 Battery 3.7V 8000mAh £15.15
  7. 2PCS Nylon Shell Brass Series Connection 2 x 26650 Batteries Storage Holder £7.14
  8. 18V to 5V buck downconverter to power esp32.
  9. 12V/24V Car Bluetooth 4.2 Audio Receiver Board Wireless Stereo Sound Module £6.08
  10. LIPO battery charge indicator £3.49
  11. Lithium Battery BMS 4S 16.8V 40A Li-ion Balance Charge 18650 21700. £4.16
  12. TDA2050 Mono Audio Power Amplifier Board Module 12-24V 5W-120W 1-Channel . about £6.
  13. Dupont 2.54mm Connector Housing Male Female Crimp Terminals
  14. Pack Size: 100 MPN: 985834 Female Quantity: 2 £4.78
  15. 2" Monacor speaker drive unit from Connevans:
  16. MZMSPX21M - Hi-Fi full range speaker, 25W MAX, 4 Ohm   £14.73    
  17. 18 volt DC Mains charger.   
  18. The use of a Desktop PC with Thonny installed (Python)  
  19. Some 0.1" pitch dupont pin and socket connectors 
  20. A DC power socket to suit the mains charger you use.        

Woodwork: Making the Cabinet

IMG_20230730_095956483.jpg
IMG_20230727_173906118.jpg
IMG_20230729_102414309.jpg
IMG_20230727_173912213.jpg
IMG_20230729_102359076.jpg
IMG_20230729_102349009.jpg
IMG_20230729_102327120.jpg
IMG_20230730_170514494.jpg
IMG_20230730_095947211.jpg
IMG_20230730_100509694.jpg
IMG_20230730_100036169.jpg
IMG_20230801_184259882.jpg
IMG_20230803_080511846.jpg
IMG_20230731_100607125.jpg
IMG_20230801_184250720.jpg
IMG_20230801_193949186.jpg
IMG_20230802_121614771.jpg
IMG_20230802_121624606.jpg
IMG_20230803_080537150.jpg
IMG_20230803_083331859.jpg
IMG_20230803_181411521.jpg
IMG_20230804_091702574.jpg

The cabinet will use sapele (mahogany) wood. It's a brilliant material to work with and looks super when it's done. There are cheaper woods out there, but we don't need much for this so I've gone upmarket here. The enclosure is in 4 parts: main exterior case, interior partition with speaker port/labrinth, base and rear panel. Base holds the batteries, amplifier and voltage downconverter. The speaker drive unit is the Monacor SPX21M:

https://www.monacor.com/products/components/speaker-technology/hi-fi-full-range-speakers-/spx-21m/


BlueTooth and Audio Stuff

IMG_20230806_172924020.jpg
IMG_20230805_193358120.jpg
IMG_20230806_172944244.jpg
IMG_20231230_104223799.jpg
s-l1600.jpg
s-l1600 (1).jpg
G101640A.jpg
G101640Z.jpg
IMG_20231231_184023917.jpg
IMG_20231231_184049309.jpg
IMG_20230805_162402609.jpg
IMG_20230805_164128675.jpg

The amplifier used is a the TDA2050 mono amplifier module. Works well with 16-18V DC power and the 4 Ohm speaker. A bass boost circuit is also used here to compensate for the small size of this drive unit. Circuit is shown. It's not my design - not sure where I 'acquired' it(!) but it works well enough. Bluetooth receiver is just an LQSC one from ebay. Accepts 5-35V power. Be very careful here to isolate and suppress any power supply noise from this unit - it's very electrically noisy. Ferrite core choke and a large electrolytic capacitor seems to sort it. Speaker enclosure is a tuned cavity with a bass reflex port at the rear (ported box).

Enclosure calculations are from https://www.diyaudioandvideo.com/Calculator/ It was tricky to tune box to optimum cutoff as it's so high to start with, but I managed to tune it to increase bass down to about 100Hz. This, together with the bass boost circuit I 'acquired' makes it sound really quite good. Bass boost circuit is switchable with a dpst toggle switch.

Battery and Power

IMG_20230806_082944379.jpg
IMG_20230804_091653372.jpg
IMG_20230806_081816161.jpg
IMG_20230805_164212175.jpg
IMG_20230803_181411521.jpg
IMG_20230806_081840608.jpg
IMG_20230806_172958116.jpg
IMG_20230806_082202324.jpg

16V power is supplied by four internal 26650 Lipo batteries in series. You'll also need a balancer/charger board in order to charge them from an external 18V dc power supply. A 4S battery state monitor is used also; be sure to configure the monitor for 4S (i.e. 4 x 4V batteries in series). On the left hand side of the unit, a DC power socket is fitted for the 18V recharge power. This wires directly into the battery balancer board. The board then connects to each voltage level in the battery pack; I used dupont 0.1" pins/sockets to connect to board. It'll handle the current. (but not much more!)

ESP32 Setup / Programming

IMG_20231231_184136498.jpg
IMG_20231231_184152403.jpg
IMG_20231114_191648778.jpg
IMG_20231114_191641883.jpg
IMG_20231216_143451889.jpg
IMG_20231218_192838551.jpg
IMG_20231116_173632899.jpg
IMG_20231231_184152403.jpg
IMG_20231128_180449781.jpg
IMG_20231125_190010533.jpg

A standard ESP32 WROOM module is used here. I'm a python person so I immediately flashed micropython onto the device and then proceeeded to program the device in micropython. You'll need to install Thonny on your desktop computer in order to program and connect to your esp32. Just click on Run - Configure Interpreter in Thonny and you get an option to use ESP32. You could as easily have used a Pico or esp8266 or any other suitable microcontroller instead of the esp32. The ESP32 must have wifi included - this one does, with an externally connected antenna. The program will do the following :

Connect and authenticate to a named WiFi network. Use NTP (network time protocol) to get the real datetime from the internet. If the device cannot connect for any reason (eg you're not at home or internet down) then it will use it's own DS1302 local real time clock which has its own internal coin battery.

Note - every time it connects to internet and gets NTP successfully, it will update its local realtime clock.

In order to run the python program, you'll need to open the following files (included in next section) and save them onto the ESP32 :

DS1302.py this is the device driver python module for the real time clock.

MAX7219_8digit.py this is the device driver python module for the LED 7 segment displays.

NTPclock_1302_V1.py this is the main python script.


You will need to rename the main python script to main.py It will then run automatically when the device is powered up.