I'm looking into equipment for a smart home project. It involves something like a RPi communicating with various uC attached to sensors and relays (actuators). The uCs are in charge of reading sensor data and energy consumption of the house and sending this info to the RPi. Accordingly, the RPi sends commands to the uC to (de)activate the relays connected to electric panels, so it can (de)activate devices accordingly.
It's pretty much a sensor-actuator network, where the uCs do the reading and actuating and the RPi is the brain that tells them what to do. The use cases are many: stopping the electric heating if it's warm enough, switching to solar power or grid power etc.
Me and proj partner were thinking the uC should support 2 ADCs: one for reading electric panel and one for temp and other sensors. 2 UART/USART for communication. Enough GPIOs to connect to (bistable) relays (actuators that turn power on/off).
Any advice is welcome, but I'm particularly curious if you have any advice on what uC to use. I was thinking STM32F103C8T6 Blue or Black Pill, but I'm not tech savvy enough to know if it supports all the features above. Furthermore I'm not sure how easy it is to set up, if soldering is involved. I'm thinking I should first get a more user friendly developer board that supports the features mentioned.
Howdy, while I encourage your ambitions, I'll advise being careful. Don't implement high consequence devices before you're Real Certain it's fully failure proofed.
I've been building embedded controllers since late 70's. I've always hated the thermostat on my house of 30 years, yet while often musing, I'll never build a replacement. If I missed ANY cause of drastic failure, my home owner insurance would laugh and slam the door. Not worth the risk.
So, start with items of small consequence regardless of failure mode and learn error detection and safe recovery methods. Building well behaved outputs from well behaved inputs is Amazingly simpler than error trapping and safe handling of ill behaved sensors and actuators. Don't be discouraged by this, Everybody starts out not knowing. Recognizing and minimizing risk is the key. Good Hunting <<<)))
I am an Arduino Atmel AVR Freak. You can get an Arduino mini PRO that does what you want for $4 each
The toolset is free from arduino.cc -- get the stand-alone version, not the web-bases (I had a bad problem with it that needed a complete wipe/reload of a laptop.) The environment makes it easy to get the ADC values && control the GPIO pins. You also get an RS232 serial port (you need to add the level shifters.)
If you need multiple serial ports, you can bit-bang it or use an ATXmega with 4 serial ports and a metric butt-load of GPIO. (I use them for a variety of projects && almost always use them for prototyping.)
If you get one, I recommend also get something like
but - I agree with the other posters about being careful and start small. Thermostats would be easy (low voltage). But anything with AC power needs working with a licensed electrician.
I'll consider the advice, thanks!
The place is some kind of depo we've built in the countryside which also has a few rooms for living. It's built as an intermediary housing/storage while the main house is built. At this time, we're mainly interested in controlling electrical panels in order to switch between solar power or grid, control devices etc. Thermostat and others might come later.
We'll probably start with an STM32F103C8 board (maybe an ESP32) and see how it goes.
Howdy, when controlling real power (AC, big DC, etc) consider redundant sensors. Both on inputs and for verification of outputs / switching. G.H <<<)))
Ambitious Project - doable on the controlling side, the logic decisions on the rPi would be the tough part - imo..
get a 26 volt AC transformer, some contactors or relays from an HVAC company
use some opto-isolated relays ( I think Adafruit has a 4 relay board) to apply the 26vac to the contactors for the heavy loads
You will want feedback that the loads are on/off - again an isolation is needed.
??What will you do if it doesn't on/off as you wanted - that contingency that someone mentioned ?? an alert ?siren phone app wifi ?? ITTT [if-this-then-that] apps are avail on web/phone - via the rPi
level translators for the serial ports as mentioned, would also recommend a 5v logic capable uC board (rPi is 3.3v logic) else more level translators
you don't mention your programming experience.....Adafruit has a bunch of uC boards that do a Python version, Coridium.us has a Basic as well as some PCBs [I do use them and beta test for the company-disclaimer]. Many boards are in the Arduino form-factor which will handle the IO controller end.
Serial is an issue - most Arduino only have one - The Coridium boards have multiple usarts in most cases - could possibly use one as a port expander/concentrator. The rPi only has one usart --
WiFi is an option if you do web programming - I don't care for BlueTooth - the pairing seems to be an issue -
Have not considered the Insurance issue side of things
Go for it....easy at first Gary