Go back

Smart energy monitor

Firmware, Hardware, Software

Smart energy monitor simulation files

Figure 1: LTSpice simulation file of the project

Smart energy monitor PCB Design

Figure 2: Altium PCB design for the project

Final working project

Figure 3: Final working project

Purpose

This project was led by my Electeng/Compsys 209 course at the University of Auckland. In teams of 4, we were tasked with reading the voltage across and current through a variable load that we were supplied.

We were able to read the voltage across the load by simply devising a voltage divider in which we would get a consistent ratio of the voltage across the load but would be able to work with a max voltage of 5V rather than a max of 20V.

We were able to read the current through the load by using a shunt resistor. Due to OHM's law, we knew that we could find the current through a resistor by simply taking the voltage across the resistor and dividing this value by the resistance.
We selected a resistor value small enough that we would not change the value of the readings significantly while also being large enough to supply us with a signal-to-noise ratio, SNR, that would allow for accurate calculations.

With both of these readings, we simply had to put them through an amplification stage, allowing for a maximum value of 5V and a minimum of 0V, with a 2.5V offset. This was to ensure that we could read the entire waveform with the microcontroller and not overload the pins.

After amplification, it was important to filter the readings. This was achieved with second-order low pass Sallenkey filters, allowing for a 40dB drop per decade.

For our design, we also opted to use two zero crossing triggers; we found that in case of noise, we would use Schmitt triggers, allowing for a small region of hysteresis and thus preventing false triggers.

Once all of these readings had been taken by the microcontroller, we simply had to find what the actual values of our readings would be and display these to our output peripherals. This included writing to UART and a common cathode 4-bit 7-segment display.

What did I learn?

Throughout this project, I learned a lot of valuable information about electronics, firmware and software, as well as how to work effectively with a team.

In terms of electronics. I learned great quantities about amplification with OPAMPs. This includes knowing when Thevenin's equivalent of a circuit should be considered within the amplification stage, such as with our voltage reading. I also learned the value of implementing first-order filters in an accuracy dependant application such as an energy monitor. For our project, we found it more valuable to use second-order filters, so I took it upon myself to learn how they work and implement them into our design.
We also learned a bit about PCB design using Altium and the benefits of using surface mount components rather than through-hole.

For the Firmware side of the project, we exclusively used the Atmega328p or Atmega328pb for surface mount. This meant that all of our code was produced using C. We had to learn how to use the datasheet for our microcontroller and where to find valuable register information. We then had to know how to set registers through bit-shifting values. On top of all this, we had a big focus on using interrupts and interrupt service routines, ISRs. We used these ISRs to: take readings, update the display and perform math, all at set intervals.

Sadly I was not able to take a big part in the software section of the project, designing the python app. This was due to the fact that I was in charge of the firmware development and verification.

There was a lot to learn when it came to working with a team.
Although I have done a lot of teamwork in the past, it has never lasted for an entire semester or been a part of a project of this size. I learned the value of performing weekly team meetings to see the progress of other team members. I also learned how sometimes people will not be as accountable as you may hope they will be and how to deal with situations like this, reaching the best possible outcomes for everyone involved. But most importantly, I learned how to remain friends with the people in my team no matter what happens and to continue working together through adversity.

Future inspiration

Although not much of the project inspired me to improve upon it or reach further, I did find inspiration in the work that we did and the things we learned. In the future, I would love the opportunity to do big group projects like this again, as well as having the ability to use the electronics and firmware skills I gained from the project in my hobbies or jobs in future.