#76 ESP32 that is Arduino & MicroPython Compatible
The ESP32 has already integrated an antenna and RF balun, power amplifier, low-noise amplifiers, filters, and power management module. The entire solution takes up the least amount of printed circuit board area. This board is used with 2.4 GHz dual-mode Wi-Fi and Bluetooth chips by TSMC 40nm low power technology, power and RF properties best, which is safe, reliable, and scale-able to a variety of applications.
Upon experiencing a few break-ins on the farm I decided to look for a simple alarm system to monitor certain door. For such a simple project a full on alarm commercial alarm system would be overkill.. So I endeavored on the short and fruitful DIY journey.
My system is based on the simple circuit from Great Scott on YouTube. The brains of the circuit is the Arduino programmable Attiny85 MCU. A reset push button, notification LED, arm/disarm toggle switch, notification buzzer and magnetic read switch are the IN/OUT components used.
The project runs on 12 volts (12 volts for the siren) which is filtered down to 5 volts for the Attiny85. My plan is to use a 12 volts 7 ampere lead acid battery combined with a smart charge board to power the project effectively.
After soldering the components onto the board everything worked fine. However the siren was very soft and the 2N2222A transistor was getting extremelyhot. This is because the transistor has to provide a ton of current to the siren in order to get it working at 100% capacity. A quick fix is to remove the 1k resistor between Attiny85 pin 1 and the transistors base.(replace it with normal wire) This allows the siren to be louder but the transistor is still hot. A possible permanent solution will be to just use a 5v relay or look for a transistor with a higher current tolerance.
In the end I decided to go with a 5v relay module since it’s a quick reliable solution but is more expensive than a transistor. In a future upgrade I will most likely use a BC517 darlington as referenced by this article. It will be cheaper than a relay and provides more than enough current for a 15W 1 tone siren (380ma).
In some cases you will have a MCU with only one analog pin (A0). For example in my case I have the Wemose D1 mini with only one analog pin (A0) however I would like to increase these pins with the MC14051B Analog Multiplexer/Demultiplexer. This is a cheap easy fix but the downside is that it requires an additional chip (the MC14051B ).
The MC14051B analog multiplexer is a digitally–controlled analog switch. The MC14051B effectively implements an SP8T solid state switch, the device feature low ON impedance and very low OFF leakage current. Control of analog signals up to the complete supply voltage range can be achieved.
I created a small breakout board to make testing and experimenting a little easier.
More information about increasing analog pins can be found here.
The Wemos D1 mini is a small WiFi based development board. The board is based off of the ESP-8266EX MCU developed by Espressif . The dimensions are 34.2*25.6 mm which allows this small package to be used effortlessly in large scale applications. Shields are also widely available and add to the ease of use for this board.
Features
11 digital IO, interrupt/pwm/I2C/one-wire supported(except D0)
1 analog input(3.2V max input)
a Micro USB connection
Compatible with MicroPython, Arduino, nodemcu
Technical specs
Operating Voltage 3.3V
Digital I/O Pins 11
Analog Input Pins 1(3.2V Max)
Clock Speed 80/160MHz
Flash 4M Bytes
Size 34.2*25.6mm
Weight 3g
My specific board comes from a company called Farylink. It looks like they make small boards with wifi capabilitys.
According to there website:
Shenzhen Huayulian technology co., LTD is an IOT company that integrates rd, production and sales and is technology-oriented and service-oriented. With a rich background in the IOT industry, it focuses on the research, development and production of IOT communications.
In order to measure the voltage of a DC battery we will need a voltage divider sensor. I built an easy DIY voltage divider which works quite well. All we need are two resistors to measure the voltage in a certain way so our Arduino doesn’t fry.
After working out my requirements for a 12v 7Ah battery I came to the conclusion that I needed a 30k and a 7.5k resistor. This will allow me to measure DC voltage from 0.025v to 25v.
I only had to break the connection on the trace where the screw terminal was soldered to.
After creating a simple Arduino sketch I was able to output the data to the serial monitor. I had to add the correction factor of -0.150 to get an accurate reading after checking with two multimeters.
I used the Arduino pro mini as the MCU of this project.
The Maduino Zero SIM808 GPS Tracker is an IOT (Internet of things) Solution based on the 32-bit Atmel’s SAMD21 MCU and GPRS/GSM GPS module SIM808. It intergrates a micro Controller ATSAMD21G18, GRRS/GSM module SIM808, which is the upgrade version of SIM900, power management and storage, to make the SIM808 GPS Tracker ready for IOT projects such as smart-home, outdoor monitoring, shared bicycle, etc. The Marduino Zero SIM808 GPS Tracker based on the Arduino, users can program it with Arduino IDE, which is very easy especially for the none-programmers.
This is the V3.4 version, Note that to ensure the module starts up right, a lipo battery is needed to power up the Maduino Zero SIM808 GPS tracker V3.4.
Quick Spec
AT Input Voltage: 3.4-4.2V
Microcontroller: ATSAMD21G18, 32-Bit ARM Cortex M0+
Clock Speed: 48 MHz
Micro SIM connector
Integrated Power Control System
AT command interface with “auto baud” detection Quad-band: 850/900/1800/1900Mz
Send and receive GPRS data (TCP/IP, HTTP, etc.)
GPS L1 C/A code
22 tracking /66 acquisition channels
Tracking: -165 dBm
Cold starts: -148 dBm
Time-To-First-Fix:Cold starts-32s (typ.), Hot starts-1s (typ.),Warm starts-5s (typ.)
The STM32 F103C8T6 (AKA BLUE PILL) Is a great development board to upgrade to from the Arduino series. The STM32 platform is a massive powerhouse that can handle complex calculations extremely quickly. Examples such as quadcopter’s, robotics etc.
FEATURES
On-board Mini USB interface, you can give the board power supply and USB communication.
On-board test indicator LED
On-board reset button and power indicator LED
On-board 100ma 3.3V Regulator
All GPIO are led out and the names of the pins are marked
After soldering the headers, you can directly plug the board onto the breadboard
TECHNICAL SPECIFICATIONS
CPU Part Number: STM32F103C8T6
Core: ARM 32 Cortex-M3 CPU.
Debug mode: SWD (can be programmed with ST-LINK V2)
The Pro Mini has proven to be a suitable solution. The board is very small and has more than enough specs to control the GSM/GPRS module while also sending data to a remote server via TCP.
The Pro Mini requires an FTDI programmer since there is no USB port on the board.
My first attempt to build a small circuit which controls a relay to an alarm speaker was a failure. Contrary to popular belief failure in electronics projects is quite common and I would argue that it is of paramount need if you want to learn anything.
Surprisingly my failure was in using the ATTINY85 instead a Pro Mini, Uno or Mega. Some problems I had were:
Not enough RAM to hold all my variables (I had to scrounge 😢)
Very limited FLASH memory.
GSM module interferes with the ATTINY’s 5v power source when connected using the same source with no filtering.
In a later project I created a reliably working solution with the Pro Mini as the brains.
My goal was to create a small circuit which uses the ATTINY85 as the brains. It uses the A6-GSM-Module to receive SMS’s, phone calls and sends TCP data. Finally it has a 5v relay which will switch on/off an alarm speaker. The theory is that when I’m on the farm in the fields and not near the house, I have the option of remotely starting an audio alarm at will. This should be a deterrent to potential criminals.
After making an easier to debug circuit I tried to get the ATTINY85 to work happily with the GSM module. This was going to be a bit complicated and I suspect I would have to isolate power between the ATTINY85 and the GSM module. This would require more components and the board is already looking cramped. A much easier solution is to use the Pro Mini instead of the ATTINY85.
The Digispark rev3 USB board is an ATtiny85 based microcontroller development board. It comes with a USB interface. Coding is similar to Arduino, and it makes use of the familiar Arduino IDE for development.
BOARD SPECS
Support Arduino IDE 1.0+ (OSX/Win/Linux)
Can be powered by USB or 5v or 7-15v (automatic matching) extra power supply