Smart Energy meter which also provides a solution to the last mile delivery problems.
Things used in this project
1. Avnet Brainium module
2. OLED display
3. ACS712 Hall effect sensor
4. Voltage divider resistors
5. Relay modules
6.Perf boards and Berg sticks
Conventional energy meters have developed from analog rotating wheel technology to digital display technology, with recent developments in MQTT protocol and low-cost IoT devices and SoCs smart meters are being employed in various industry and household uses. But all these smart meters are really smart or are they are just a dumb box with fancy lights and displays?
With everyday growing IoT devices we will be reaching around 50B by 2020, but are these devices secure? Can it be hacked? Various questions pop up as soon as we hear this news about growing connected devices and their vulnerability of getting hacked.
Recently a nuclear reactor was hacked by anonymous hackers and they demanded ransom money to give back the control of nuclear reactor to authority. These type of attacks on connected devices can result in catastrophic disaster and can cause the loss of millions of people. Even a smart bulb which works for a few years will contain your Wifi credentials as it will store everything in its memory. Anyone with certain tools and types of equipment can easily get it from the device memory itself.
So, in conclusion, IoT security is very much important in this growing era of connected devices.
In this project, I will be using the Microsoft Azure Sphere IoT development board to make a smart energy meter which is very secure (Of course it has to be secure, I don't my neighbour to control my power..!) and with the added functionality of IoT Locker for last-mile delivery.
All these years energy meters are just dumb boxes which sit outside the house in a corner where no one goes. Since our energy meter is smart and is network-connected it can be used for other purposes also and this can be monetized. Ok, here is how this solution works.
The energy meter is the first part of the solution which in realtime sends the value of Current, Voltage, Power, Temperature etc to the cloud infrastructure set up by energy company.
This setup's output can be monitored controlled by the energy company itself. This will help in easy connection and disconnection of users and load balancing in peak hours by restricting output power etc. with just a click of a button. Also, this allows the user to check his usage in real-time and take actions based on consumptions.
The second part: IoT Locker
Most of the logistics companies use their field delivery executives to deliver the goods to the customer's location via last-mile delivery solution i.e 2 wheeler or a truck. Most of the times the concerned person will not be around and the delivery person has to return back as there is no one to take the parcel. Hence people usually give their workplace address to avoid this when they are not in their residence. This will create issues such as logistics company assigning the order to the workplace just by looking at the address and creating an invoice in the company name. This causes lots of other issues such as taxations etc. (Happened with me only for my Hackster.io shipment)
To avoid all these I'm proposing a novel idea of using energy meter as a locker box which can open and close by the command given by the concerned authority with a click of a button. The logistics companies will use this locker as an intelligent asset which can be controlled by Azure Cloud to open and close. Since there is already huge security between azure sphere board and module the locker will be safe and hence can save carbon footprint by a huge amount.
Step 1: Gether all the parts required:
I have mentioned required parts in the beginning only, please refer to that.
Step 2: The plan
0.96" I2C OLED display will be used to show the power usage and other information. ACS712 will be used to measure the electric current that is being used by the house. Voltage sensors are also connected to measure the voltage. Then there will be a locking mechanism which will be used to lock and unlock the box.
A relay will be attached to the board to control the ON and OFF of power connection to the home and also to activate and deactivate the solenoid lock
Step 3: Connecting and Soldering:
I will be making a shield for the existing Azure board so that it can be easily accessed without connecting external wires or jumpers. I use bare board PCB a.k.a perf-board for this.
Step 4: Setting up the Azure board:
There is a very good tutorial by Brian Willess for setting up the board registering and securing things. So I'm not gonna waste your time in explaining basic things.
Even I completed the course and tried sending data back and forth from the board to the cloud and vice-versa.
I referred to the advanced course for setting up the OLED and ADC part.
There is a very nice data visualisation tool on the cloud itself which has tons of options to toggle between various views and turn on and turn off of visualisation for particular devices etc.
I must say the UI and UX team has worked on this to make it look very cool and easy to operate.
Step 5: Attaching everything and Coding:
Her's the project URL: https://github.com/vishwasnavada/AzureEnergyMeter.git
Connect the sensor and other parts such as relay etc to the board and start coding to get it up and running. Here the coding logic goes like this :
1. Current sensor: ACS 712 is hall effect-based current sensor which gives output in terms of analog voltage which will be fed to ADC and the value has to be subtracted by Vcc/2 voltage as it is a bias voltage for the sensor. Then for increase 1A of current, there will be 66mV change in output. Now we can measure the current consumed at an instant. Connect this to analog sensor 2 i.e GPIO42.
2. Voltage sensor: For the prototype, I will be using the DC voltage sensors which are nothing but voltage divider resistors which will report analog voltage to the board. This can be modified with a simple circuit to work for AC also. This is GPIO43.
Hence we will be needing 2 analog channels to sense the voltage and current. We can even sense the temperature of the board to get the insights of the board's working temperature and atmospheric temperature and draw the relationship between the power consumption of the house with respect to temperature change and time. This data is very much helpful in load balancing across the city.
Smart Locker: A relay will be given to control the locker's solenoid positions. The solenoid will be in the locked state when there is no energy is being applied to it. When there is an open command relay will operate and release the lock. This method is foolproof as if someone tries to steal by cutting wires the lock will be safe as the normal state is locked.
Step 6: Working Video:
Here's a working video of how the system works:
1. Adding PIR (Passive Infra-Red) motion sensors to the locker box to detect the movement of people or suspicious activities
2. Adding an IR sensor to detect the presence of the package inside the box.
3. Adding onboard diagnostics and predictive maintenance so that it can protect fuse failure before it reaches threshold current consumption
4. Giving insights to the user about the power usage and help him/her to save on electricity bill for an environment-friendly better world.
5. Using the power usage data with respect to time and other parameters to get insights about peak hours and load balancing requirement between industry and households.