I'd like to share a project I'm working on for a friend. He is a 4th year Mechanical Engineering student at Western University in Ontario.
His father has built a chicken coop on his property and as part of his hobby bought a Solar Panel. This solar panel will be used to heat the chicken coup during the winter, and run a large light. It also has some external plugs that allow devices to be plugged in charged from outside. One of the crucial parts is the inverter which converts electricity between AC and DC.
My part of the project is to write the code for the microcontroller which controls the flow of electricity, for example deciding if we should charge the battery or heat the chicken coop, based on things like battery temperature, battery charge, and temperature of the coop. There are also some safety features such as turning off the transformer if the battery or microcontroller case get too hot.
General overview of the program is as follows:
- Turns on and off inverter, 12v load, and 24V load based on temperature, and battery states.
- Gives three LED outputs to convey simple information about the state.
- Relays state of 2 LEDS from the inverter to the remote switch.
- Relays the push of the remote switch to the inverter.
- Turns fans on and off based on temp to avoid overheating.
- errors that occur can be saved as a variable and displayed as a blinking red LED. The number of blinks can be looked up by a printed table.
- Errors include Voltage out of normal range, and temperature out of normal range.
- Water temperature is monitored to avoid boiling or freezing.
- BMS (Battery Management System) is monitored to determine if loads should be active or disconnected
We’re in different cities at the moment so collaboration has been one of the most difficult aspects. My typical programming process is to write code and then test it to see the result and do this many times over and over quickly. However with this project I keep needing to get him to upload the sketch and test it, this has been a huge headache and causing issues on both ends. We plan to setup a remote desktop on his laptop connected to the Arduino so that I can upload sketches and test the serial output myself.
Well we’re using Arduino for this project we’re interested in exploring other micro-controllers that have more pins. Arduino is based on C++ but gives you a lot of methods out of the box that makes things easier. So I’m interested to find out what steps will be needed to go from Arduino based projects to micro-controllers running C++.