A Fridge Alarm
This project describes how to hack a fridge to send an alarm by e-mail when somebody open it during the night!
You just need an openPicus IoT Kit (that contains a FlyportPRO Wi-Fi) and a Grove Light sensor.
List of Materials
- 1 IoT Kit Wi-Fi: it contains an IoT board, 1 FlyportPRO Wi-Fi and a power supply
- 1 Grove Light Sensor
- 1 microUSB cable
- 1 Lithum battery (optional)
- A PC with Windows OS or MAC/Linux with a Virtual Machine (to develop and flash the firmware on the IoT Kit)
1. Plug the Light Sensor to the IoT Kit on the AN1 connector.
2. Connect your PC to the IoT Kit via the microUSB cable
3. Connect the power supply on +5V connector or a 3,7V rechargeable battery on BATTERY connector.
We used Gmail to send emails and it needs SSL connection. For legal reasons we can’t redistribute the SSL library on the source code.
Before starting you must enable our IDEpro with SSL. Just follow the SSL Tutorial.
First of all the firmware creates a softAP Wi-Fi network. Using your smartphone or PC scan for the Wi-Fi networks and connect to “IoT Kit softAP”.
Now open a browser and type 192.168.1.115
Now the integrated web server shows a configuration page where you have to insert your Wi-Fi network parameters, email and alarm active period. Once parameters are saved the kit restarts and connects to your Wi-Fi network.
If everything is ok you will see LED1 on, Led2 blinks during the alarm active period.
So if, during the alarm active period, the light sensor changes status (when you open the fridge door its light activates) an email will be sent.
Note: If now is 8am and you set Alarm Start at 6am it’s gonna be active tomorrow!
Once connected the time is retrived by SNTP over Internet and the internal RTCC starts to work.
The light sensor measures the light level from 0 to 1024. On this hack the threshold is fixed to the value of 70 (but you can change it).
When the alarm is active and the light threshold is exceeded the system will send an email.
Download source code
DOWNLOAD project source code.
Now open the project on the IDEpro, compile and download it to the IoT Kit.