After a brief 6 month long hiatus, I've started working on this again. Some things I've done since the last project log:
- Made nearly all components surface mount to reduce cost and space
- The board is now 5x5cm, which is the sweet spot price point at many board fabs.
- LDO's were out of Vin spec
- My main clue for this is when one burned up upon applying power.
- Changed values on the analog measurement resistors
- Found out no load voltage from the wall transformer is 11.3Vrms (Nominal rating is 9Vrms), which prompted some new resistor values
- Changed diode to standard silicon
- For reasons that escape me now I changed the schottky to standard silicon, 0.5A rating changed to 1A. Probably because I was no longer bumping up against the 5V LDO's Vin requirement with the new 11.3Vrms power supply.
- Changed sample rate to 2400Hz, adequate to 10th harmonic
- The PIC couldn't handle the higher sample rate with all the calculations I'm doing. Still need to experiment if the higher sample rate is worth while.
- Got NRF24 working
- This bogged me down for a while. I finally set up an NRF24 on a Raspberry Pi and used the NRF24 python library for it. Couldn't figure out why it wasn't communicating for the longest time until I looked at the SPI1Write() function I was using from the PIC18 peripheral library that comes with the compiler. It was polling for an interrupt flag by default instead of the Buffer Full status bit that indicates an SPI transfer is complete. I'm not using the SPI interrupt so I changed that part and it works now.
- Added RF stats and status to LCD
- New screen shows status and # dropped packets
- Latest version of XC8 compiler gets rid of PIC18 peripheral libraries.
- After updating the compiler I found out they removed the PIC18 peripheral libraries that I used for a couple things. Namely setting up timers. Perhaps eventually I'll take those libraries out, but for now I'll be lazy and continue using XC8 v1.33 instead of the latest.
- Needed to add a delay on power up before talking to LCD and NRF24
- Found out the radio would only work after programming the PIC, but not on power up. Also the display would sometimes show strange characters after power on. Added a 5ms initialization delay before talking to either of them and that fixed the problem.
The actual power monitor device has all the functionality to be standalone now, but before I can call it that I'd like to finish up a few more things:
- Add phase compensation
- I can measure the voltage phase shift from the wall transformer easily enough, but I'll need to set up a resistive load to measure the phase shift from the current transformer. Need to see if I have any old light bulbs...
- Once that's measured I'll need to add some kind of interpolation between samples for the phase shifts.
- Adjust Vin scale when LCD backlight is on/off
- The wall transformers' output voltage varies between 11.3Vrms at no load to 9Vrms at full load. It's about 11.1Vrms with the LCD backlight on. I just need to quantify the different scalings, then with the average of the analog input determine which scale to use. Right now I'm summing the square of the analog input for the voltage measurement, so I'll need to keep track of this separately.
- Delve into noise on analog inputs
- In trying to get the radio working I've been testing with the current transformers unplugged. There's a small amount of noise on those inputs which will have them read about 8mA each. This combined with the phase errors is showing power readings of 2-3W/VA. I'll need to characterize the noise and see if anything can be done for it in software, or see if it goes away once the current transformer is attached.
As for the rPi, the plan is:
- Capture transmitted data
- I'm currently just displaying it on screen, but I'll transition into storing it in a database.
- Display data in a chart
- Access chart over the network via http
If anyone was following this waiting for an opportunity to build, the hardware is working now and you should be able to recreate it. Just software development from here on out. Lastly, I updated the repository with the latest files, and I'll add more pictures to this site shortly. It might be a while before my next post, but hopefully not 6 months!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.