My favorite is the ATTINY 85. It's so cheap and yet, it can do almost most of the things you can do an Arduino. And yes, you can program it using the Arduino IDE as well.
Last year, I started out to digitalize my entire house with these tiny ATTINY 85 chips and with some nrF wireless chips. It has worked really well for me and I'm able to control and monitor any power port in my house as well as my mains.
The overall setup still costed less than a Nest, yet, vastly more powerful. Of course, the downside is you need to write code, have a running server to control it on the cloud. But, no problem for me as I'm a (Google Cloud) consultant and this is what I do for a living.
I use Google Cloud's IAP with AppEngine (I may switch to cloud run now, since it's cheaper tho) and I have a private REST server running that I can access from my own Android app.
The whole thing took me a year to finish, but that's because I worked on it maybe once or twice a week in the weekends and didn't focus on it much.
But, my effort has paid off and it's amazing to me that what is possible with just a dollar investment.
As someone building up some home automation I'd love to know how you are monitoring and controlling power. Remote power strips? Replacement outlets? Something diy?
For household energy usage monitoring, I installed an off-the-shelf DIN rail power meter with LEDs. I ignore the meter readout, but the LEDs give off a brief flash every Wh or so (don't remember the scale, but it was precise enough) — these flashes are processed by three phototransistors hooked up directly to I/O pins of a microcontroller, generating interrupts.
This results in a safe, reliable and simple monitoring system.
On a related note, as to microcontroller choices: having done quite a bit of work with MSP430 and various NXP Kinetis chips, I am very, very tired of crappy software engineering practices, monstrous IDEs which are all a reworked version of Eclipse, bad libraries and frameworks which change direction seemingly every month. So I decided to stick with the Nordic Semiconductor chips (mostly nRF52832 and 52840 these days). Yes, they are more expensive per chip. But I don't use hundreds of them, and the savings in my time are huge: their SDKs are nice, you don't have to use their IDEs, you can stick to gcc and Makefiles, and it's overall a decent experience.
In general, while I really like the article series, I don't think the price of a microcontroller matters much in hobby usage. It's very important in commercial designs, but at home where you will never use more than 10 — who cares? It's the overall development experience that matters.
Nordic seem to have the best understanding of what actually makes life easier for embedded software, which is really nice. Most other vendors seem to have done a lot of work to try and make things 'easy' but don't quite seem to have understood the goal.
I might be misreading your post, but there's nothing stopping you from using a gcc+make+$EDITOR workflow with the Kinetis or MSP430 chips either. I've done both, it's not even painful. (Admittedly I haven't worked with MSP430s in about a decade, maybe the situation has changed, but it seems unlikely.)
If your meter broadcasts your household energy usage, you may be able to use a ~$20 SDR dongle hooked up to a Raspberry Pi to read the kWh of the whole house several times per minute.
I've been considering getting an sdr, I think you've just pushed me over the edge - thanks! The dream however would be per outlet (or circuit) monitoring. Setting up alerts if wife leaves the hair straightener plugged in, fan left on, etc.
Sure. Power monitoring is tricky. Rest are simple.
Power monitoring involves converting the mains voltage to DC that is almost proportional to the mains voltage. Then you would rectify it and downsize it and get it to a voltage level that whatever power management IC you use can accept. You also need to include fuses and other safety circuitry to ensure it doesn't exceed that threshold your microcontroller can accept. For example, if my uC works based off just 5 volts, I want to make sure I downsize my 120VAC to just 2.5V but still proportional, this means, when there is a spike, my uC can take a hit upto 5 volts, but that means my actual power supply has a spike of 100%, which means I'm getting 240VAC on a 120VAC outlet (which has never happened so far).
Then, for the actual turning on or off of switches itself, I just use relays and some relay/motor coil ICs to control them. Sorry I don't remember exactly as this was a year ago and this system is lying inside my wall. So I need to remove the switchboard (and use a lens) to find out the numbers. But then, you can always google for "Power management / mains voltage IC", you can find even ready made modules on eBay.
Not as powerful, but still a smaller version of those arcs. So, you want to use well rated components with decent thresholds. Eg. Don't use a low power relay, cheap capacitors, etc.
All of this is then passed on through uCs(ATTINY 85 + other uCs in the circuit) to some nrF wireless modules I bought in bulk on AliBaba through my uC
To be clear, each switchboard housing contains - a couple of relays, uCs, nRF modules, temperature and humidity sensors and some infrared sensors (I don't use them anymore). I believe they also have overvoltage protection and short circuit protection in built (because of an IC I use). It will simply turn the relay off in the event of a spike or short circuit.
BTW, AliBaba is the cheapest. Don't buy from AliExpress, it's usually plagued with dropshippers (god, I hate them so much) who just keep hefty margins off a factory somewhere that you can find on AliBaba. Other alternatives, but still under AliBaba group: 1688.com, tmall.com
If you think about it, in cloud lingo, we would call this architecture as "micro services" except that there's one big monolith which is my mains module run by an old laptop motherboard. (Sony Vaio FZ series)
This nrF module talks to a an old laptop motherboard through serial, that passes information to a REST API. This laptop motherboard is located where usually all the mains connections go in. One thing I didn't use on purpose is smart trippers/circuit breakers. Sure, they're smart, but you're relying on someone else for security while also giving away your power usage consumption data. Besides, if a circuit breaker goes off, you want to know why it happened before turning it on, so I find it pointless to make them be able to turn on automatically or from your phone when I can just walk to my mains box and turn it on myself.
The REST API is built with Phoenix/Elixir, and is hosted on Google Cloud AppEngine. I haven't had any downtime so far (yet) and is blazing fast. Like I said, I'm a Google Cloud consultant, so this is what I do for a living. You may have luck doing the same with AWS/DigitalOcean. Just use something you know well.
And don't ever get into doing devops for this kind of thing. It's more critical than you think. So, don't make choices like try to save up on the servers by running your own instance on a DO droplet for 5 bucks a month. Sure, you saved up some cash, but the devops it takes you will cost you more. More importantly, if some hacker gets in, you're doomed!
Once, when I was in my house, the lights and TV suddenly started turning on and off in the hall room. This was right after I came back from watching Insidious and it was really scary. Then I found out, it happened because there was a really fat mouse on the motherboard (don't know how it got there) walking around the jumper wires. Haha!
Hope this helps, sorry I will try to update with specifics maybe in a separate blog post here.
> You also need to include fuses and other safety circuitry to ensure it doesn't exceed that threshold your microcontroller can accept.
I'd say you need to include other safety circuitry, as well as proper PCB design, to make sure it doesn't start a fire.
If you don't know what you're doing, don't rely on random stuff from AliExpress etc to be grid safe, and don't try to make stuff that connects to the grid yourself.
If you do not know what you're doing, for stuff like this I'd go with say Fibaro Z-Wave stuff or similar devices which have built-in power monitors, and can interface with Home Assistant or similar.
There are also cheap-ish USB devices that can do that [1] that you can stick in a raspberry pi and control with pretty much any language including python. For someone who shouldn’t be trusted with high voltage like me that’s the right level of tinkering.
Of course, that goes without saying, to be clear, I'm not advocating buying random off the shelf parts from AliBaba. I recommend doing proper research and getting certified safe parts for mains and I also agree not to play with the mains if you don't know what you're doing, it is far from a hobbyist thing and the only reason I did this is because I have a background in electrical and electronics.
Having said that, you can always buy "modules" from Siemens, Honeywell, etc. Get your circuits audited by someone with more experience, in particular by an experienced electrical engineer before using it live.
Have multiple levels of fail-safe, fuses, fire retardant casings, what not. Just think of every possible worse-case scenario before you do it.
After all, electricity is no joke and can literally kill you.
watermelon0 has the correct answer: [most] hobbyists should stick 100% to low-voltage low-current applications and use off the shelf certified hardware whene interfacing with high-voltage (i.e. mains) power.
If you have a device drawing high current, you would probably use a contactor (high-power relay), and then you can use low current (or even low voltage) relay/triac to drive the contactor from your circuit.
High power relays with safety certifications are typically used in mains boxes available commercially. In fact, I'm using the ones from my old mains box.
Even theoretically, the only way a relay could catch fire if the coil inside overheats or if you pass very high voltages to the coil. But, with a well designed circuit, it should be fine.
I prefer having the REST API running on a raspberry pi or a local server, that can proxy things to Google Cloud and back, just because in case something happens to the internet connection, your house is bricked, by having a local instance your system does not rely on your ISP for speed and availability.
I'd be curious of how do you update these devices, did you get OTA to work through an nRF24? did you need some external eeprom for that?
Can you buy single items on AliBaba? I've been buying from AliExpress a lot because of the convenience, I didn't know you could do the same on the main site?
I'm just curious how your homeowner's insurance feels about this? That is, will they still pay out for a claim should something happen, and they determine your modifications were at fault?
Because if the adjuster or whomever does find you have such modifications - they -will- blame those.
And probably deny your claim and coverage (and probably cancel your policy).
At least that would likely be your experience if you live in the United States.
I've often thought that having such a system would be fun, but the potential downside should anything go wrong has put a damper on it (even if whatever happened was not related to your modifications - they will blame it on them, just to get out of the claim).
The only "inexpensive" way around it is to use UL listed interfaces made by a third party, then interface with those. But there, you don't usually get everything you want.
Of course at that point, the insurance company might just shift the burden on you to "So, did you have this done by a licensed electrician? Where is your inspection report?"...
I agree. I bought a little relay board a few years ago to get started on a project for controlling line voltage, but then I started to think:
- Will the board short if it happens to collect moisture, oil, dust, or lint? What if a bug is attracted to it? Will I even monitor the condition of the board?
- Will the traces and relays heat up if I accidentally draw too much current through them? Will they degrade over time?
- Is there a chance that vibration could loosen the board and make unintentional connections?
I decided I probably could never answer these questions well enough to satisfy an insurance company. It doesn't matter that I have plenty of experience with line voltage; what matters is that I am not a licensed electrician. Therefore, at home, I only experiment with low voltage and low current, delegating all line voltage to UL listed devices.
I went with a IotaWatt for measuring my home energy usage. It is based on the ESP8266 and is completely opensource hardware and software. You retain control of your data or you send to an external server.
It doesn't measure voltage and thus can't measure true energy consumption = power, only currents. It then must estimate power based on some preset voltage. Not to mention those clamps can't have precision or time resolution for truly interesting stuff.
A toy, in other words. It might be good enough to get a rough idea what eats more or less and when, but it'll never match the utility power meter which is what you're paying by.
cdrc: I rewire my houses myself, because those licensed loons can't be trusted with a 12V light bulb. At least that way _I_ am sure it won't blow up or burn or whatever.
Still, inductive current measurement with the sizes of the clamps they show and typical currents they're measuring isn't accurate at all. Not even considering that voltage measuremens via a wall wart would depend on what load is currently sharing the same wiring.
This might be my bias since I design similar stuff for solar offgrid, where a percent or ten off are that much in capex divided by battery lifetime, then multiplied by battery cost. It bites.
I don't trust inductive clamps at low currents. I would never trust measuring voltage on the same line as a load.
Hall sensors or current shunts; voltage dividers - all driving MCU ADC channels via optoisolated opamps. Everything measured as near to the source as possible. Otherwise you're getting nearly worthless data.
Then you haven't taken into account noise building up in every half inch of a cable that leads from the clamp to the instr-amp. Or do you advocate clamps with built-in ADCs? No objection then, as long as the wires carry digital signal but for the fact that this would cost so much it isn't funny. One might as well stick to off-the-shelf PLC-style rail-mounted IO modules and shunts/transformers then.
In the US the home owners policy like auto insurance isn't to protect the home owner. It's to protect the bank holding the mortgage.
The flip side of that is the risk of a geek installing a power monitor without permits pales in comparison to someone plugging a 1500 Watt wall heater an an ancient wall outlet.
If an incident occurs and they identify additional components connected to the "trigger" you'd have to provide the whole "paper trail" for every single bit of your setup and show that it's above board: were the components certified for the use, were they installed by authorized personnel, were they operated properly, was the code you wrote for it to blame, etc. If you handled all the implementation yourself then it's hard to pass the responsibility along. While not impossible, it's still a high bar. And you wouldn't be in the best position to fight.
If it's an electrical fire and they find modifications to the electrical wiring the chances of getting the insurance money are slim. Unless those modifications are explicitly covered by the insurance.
Given the kind of exposure insurance companies have they are willing to invest a lot in fighting the payout. It's their business model.
> you'd have to provide the whole "paper trail" for every single bit of your setup
Can you cite any firsthand account of this sort of thing happening somewhere in the US? Given the ease with which people can reach millions of people with their tale of woe/outrage the fact that such stories are not readily available on social media makes me think this is mostly urban legend.
Not sure I understand, you think it's an urban legend that an insurance company will do what it can to avoid a payout especially when the incident involves unauthorized modifications to the electrical wiring of the house, which ended up triggering a fire?
There's no need to cite firsthand accounts, you will find this in your own insurance contract. Insurance works pretty much the same everywhere, unauthorized modifications (especially to critical systems) usually invalidate any insurance claim when they can be linked to the incident. [0] Electrical wiring, plumbing, structure of the building, safety or security systems, etc. And it makes perfect sense if you think about it.
I believe it is an urban legend that homeowner's insurance claims (specifically fire damage to structure or other contents) are being denied with any frequency because a 'homebrew' contraption was present in the home, adjacent to the start of the fire, or even the source of ignition.
Exclusion B on page 12 is probably the relevant section. It excludes loss due to "Faulty, inadequate or defective:... workmanship, re-
pair, construction, renovation, remodeling,..." but also contains an "ensuing loss" exception.
> A classic example [of an ensuing loss exception] is if faulty repair resulted in improper wiring and the improper wiring caused a fire. Almost every insurer would pay for the fire damage, but not for the repair of the improper wiring.
1) The insurance company will more often than not sue the party responsible for the faulty workmanship that triggered the incident to recover the money (I've seen this happen). In this case the owner is that party.
2) One real example is enough to show it's not a legend and you provided it yourself:
> Some courts have upheld this rather cramped reading of the exclusion, while others construe it properly and require insurers to pay for the water damage
Since it's upheld in court I find your statement that it's an urban legend pretty confusing. It's like showing a picture of the night sky to prove the Sun is a myth.
YMMV of course, you should read your own contract to see what's stipulated and how comprehensive it is, and case law in your jurisdiction to see if courts would rule in your favor. But better be safe and start from the assumption that the "urban legend" is real since courts support it. It's the kind of legend that might cost you money.
Are you saying you know of an instance where an insurance company sued their own customer for accidentally burning down their own house? I'd like to know more about the particulars because that sounds like another urban legend.
Another? Didn't we clear this one already above when your link showed courts upheld the "legend"? Are you contradicting me or the courts? Feels like you're no longer looking for any evidence, just grasping at straws.
Plenty of resources that tell you that it's perfectly possible to get no payout (depends on your contract of course)[0][1]. Or they will pay out but capped to a low figure [3]. Again, read your contract and decide what applies to you, pray there's no fineprint to screw you over.
P.S. No, I do not know any cases where the owner was sued but I do know many cases where the insurance company payed out and then sued the company that did the faulty repairs to recover the entire payout. I also know one case where a faulty repair done by the owner caused a fire that injured the tenant - the owner was found guilty of recklessness/gross negligence (no idea about the insurance in that case).
> "you think it's an urban legend that an insurance company will do what it can to avoid a payout"
First-party claims, absolutely. Insurers want to pay when they are liable, and they don't want to pay when they are not. Your contract defines that, and your contract is written in plain English.
Insurers aren't out to get you, and the insurance industry doesn't rely on shafting people to make money. When you purchase insurance your policy is priced according to the exposure it creates, but a lot of people mistakenly assume that the insurer's profit comes from premium payments. It often doesn't. From what I have read, insurers are generally happy to break even on premiums vs. payouts. Their profit comes from investing the float and earning a return on those investments.
Related, I think that most people don't understand how tightly regulated insurance is, and how much it can suck for an insurer to improperly deny a claim. It creates huge legal and regulatory exposure for the insurer.
Indeed they are not. They are out to maximize profit either by not paying out when possible (sometimes only if forced by the court), or by paying out and recovering the money from the party to blame for the damage (in this case also the owner). And as the links provided below show, many courts see it their way and consider that damage cause by faulty workmanship is not covered by insurance.
I've done my part, the court supporting my claim shows it's as real as it gets. If you want to support your claim that it's an urban legend all you have to do is show that this never actually happened.
The relevant court decision in that link related to faulty construction resulting in water incursion over months/years. I don't see how that is at all analogous to the scenario we have been discussing (DIY smart outlet malfunctions, house burns down).
> And probably deny your claim and coverage (and probably cancel your policy).
Can you point me to an instance of this actually happening? I see this warning given all the time but have to date never found an instance where someone's claim was denied for these sorts of reasons.
A homebrew device with some IGBTs controlling main voltages, controlled by an Arduino, is vastly different from a commercial product that has to pass UL/Intertek/TUV certification (not to mention FCC EMC compliance). Those certifications exist specifically to protect consumers from devices that will burn their house down.
This isn't to say that I would discourage a hobbyist from building their home automation controls. I would strongly recommend learning about designing electronics for mains voltage (creepage and clearance, grounding strategy, fuses and other circuit protection, types of transformers and how they're built (double insulated?), capacitor voltage rating|derating, ripple current ratings, lifetime vs. temperature, etc.
You can be a hobbyist and design things well, just be thorough when it's something that can set you and everything you love on fire if you do it wrong.
Here's a recent example where a guy designed an RF system (at 315 MHz) and it prevented garage doors opening in his neighborhood. He's described as an "electronics enthusiast". Thankfully, no one was hurt with this electronics misadventure. http://www.arrl.org/news/view/hams-help-trace-mystery-signal...
My favorite is the ATTINY 85. It's so cheap and yet, it can do almost most of the things you can do an Arduino. And yes, you can program it using the Arduino IDE as well.
How do you deal with the small number of pins? The NRF24L01+ uses SPI, which requires 4 pins. There are some guides on how to hook up an NRF with 3 pins. I think that only leaves 3 pins (besides VCC and GND)?
The ATtiny seems to be very attractive otherwise, because it works across a relatively large voltage range and does not use a lot of power.
Did you consider the ATtiny84, which has double the GPIO pins?
I did consider the ATTINY 84, in fact it was the 84 was the one I wanted to order. But due to a mistake, I had ordered the 85 instead. So, when they arrived, I didn't really feel like waiting another week to get working on this project, so I found an online hack/article that allowed me to use the 85s with just 3 pins. I can't remember exactly (it was a year ago), but something similar to this I guess:
I have no clue what your project is, but a lot of us like the ESP8266/ESP32 which are ~2$ and ~5 per module, or around double with their dev kits. Get's you lots of GPIO + wifi.
> Robotdyn Blue Pill (STM32, fun for playing with Rust).
$3.49 is great, nice find. Hopefully now that Espressif has unveiled their fork of LLVM you (as well as myself :P) will be able to use Rust on the ESP chips soon enough.
For regular STM32F103C8T6 blue pills, of course there are lots of sellers on AliExpress that go lower. The lowest right now [1] is listing them for $1.53.
That said, it's really confusing how much flash memory are on these. The community seems to find that they list as 64 KB, but in reality ST has been shipping the part with 128 KB without saying. I have two black pills (slightly different board, same MCU) but the one I tested only has 64 KB. :(
But the RobotDyn Blue Pill has the correct USB resistor values. Also, a lot of unnamed Blue Pills come with bad voltage regulators. My time is worth the extra $2 ;).
The thing with this kind of setup is that it almost always works out cheaper to just buy a microcontroller with more pins. For example, you can easily get hold of 48 pin Cortex M0 parts for under $1.
This sounds really interesting and is something I’ve been meaning to do for my house as well. Do you have a blog post with the details or a github page?
What? How? Explain please. I've been interested in this for a while, and I know how cheap the ATTINY85 is but I just started experimenting with the Arduino, and just got a relay to switch on/off. Still learning how to get the ArduoCAM to work, and how I can transmit images over WiFi.
My point is, can you link to a tutorial? I'm a newb, but I'm a fairly competent full-stack developer.
What's your experience with running your server non-locally? Not judging, just curious as usually those that DIY their home automations are also into homelab stuff and setup a spare laptop or something for the server.
Derp - You're a cloud consultant, oh okay haha. I'm guessing your home ISP network is pretty reliable then? I'm stuck on con-cast so unfortunetly I have to be prepared for occasional high-packet loss/no internet situations. They're fairly rare, but I want to make sure my lights can be controlled 24/7
It depends on your requirements. I don't need to constantly monitor what my voltage values are. I just want stuff to happen when I send a REST API call. So, I'm not too bothered about latency. I just need to know if there's an outage or overvoltage, or short circuit, etc..
Maybe if we just put 10 of these mini-controllers in each home, we can cover the majority of electricity consumption, and get demand flexibility the cheap way (instead of fitting each home with an expensive smart meter).
(Obviously the cloud/app parts will have to be centralized with consumer opt-in and preferences etc..)
There's a world of difference between a hobby project and a large-scale production item. The CPU in the smart meter likely isn't much more powerful than an ATTiny. By the time you've scaled this project up to meet the needs of the electric company, the cost is likely comparable to what they already have.
BOM (Bill Of Materials) cost is rarely the limiting factor on commercial products. The selling price of most devices is usually a large multiple of the cost of components.
I'm curious, is this a common problem? At least here in Michigan, our electric company essentially replaced all meters with smart meters for free, unless you choose to opt-out.
Power-measuring outlets do exist, Belkin has one under the WEMO brand for example. It's just that it generally makes far more sense (for the electric company) to put the meter in one spot, instead of every outlet.
You still have to have the mini-controllers communicate with the power company though, so I'm not sure what problem you'd be solving?
There's also Sense, which monitors for the distinct waveforms of your big inductive loads— washer, fridge, A/C, etc. I don't have one yet, but my colleague who does absolutely swears by it. Allegedly you basically get whole-home monitoring with a single tap at the panel:
> I bet your people think you're as crazy as my people think of me.
For one year, it was constant annoying discouragement. Then, once we had this party in my house and I showed it off to everyone and they finally realized its worth. To me, the privacy factor is alone worth doing this project.
Me too. A neat part of it is being able to share what I've built and get and feel the appreciation for what I've done.
It's not like that in my software life. Like databases are not as... neat to most people but everyone can appreciate something they can see and touch and control.
I've got a Google Home and LIFX bulbs, but I've also spent hundreds and hundreds of hours learning, tinkering and coding. I can do this because I'm single and am lucky enough to have a lot of free time.
If I was doing it again, I'd stick with the LIFX bulbs and use the hundreds of hours doing something that would earn me some money.
Totally with you. The tiny original Digispark (with the USB traces on the board itself) is my fave - I use them for teaching school clubs and personal projects/gifts. If I need to go beyond that, it usually means straight to the ESP8266 or ESP32. But that's pretty rare. (With you on the nRFs, too!)
How do you like the nRFs? I've been all over the ESP8266/ESP32 since it came out, they're crazily versatile chips!
I've been interested in Lora/nRF/LoraWAN for some of my low-power further range projects. I'm just curious as to how they compare to the ESP's.
Also, how do you power your projects? I'm considering buying 6+ usb bricks, but I'm skeptical of non-brand name ones, and brand name bricks are expensive. After watching BigClive though I'm sure I trust any non-brand name ones....
I can’t really speak to the difference between ESPs and nRFs - I haven’t played with ESP mesh networking enough to compare them. The nRFs just get used because I already have libraries that I use and enough chips on hand. (I would imagine the ESP at this point is superior in every regard? It just has such an ecosystem around it.)
For powering projects, it depends - most projects I do can be plugged into a laptop or into the wall - I have a programmable light array that is the main project I do with the kids. For other portable projects, I might use 18650s, might use coin cells, might just use AAs. This is a big topic and I’ve been meaning to write this up in detail.
Thanks for the questions! Sorry it took me until now to respond.
How often do you want to send/receive data? I experimented with a Wemos D1 Mini and a pack of 4 rechargeable NiMH batteries (LiPo batteries seem like playing with fire, literally). In deep sleep the power consumption is very low, I measured something close to the 20uA from the spec sheet.
Yeah from what I've seen you can desolder the status LED to lower the current even more. With the ESP32's you can use the lower power processor as well.
I want to automate my blinds, which is kinda annoying as that means ~6 different, "high up" spots in high visibility areas, and obvious motors mean "high power" (compared to micro amps).
I'm really not sure how to approach this one yet...
How are you switching mains power safely? I looked into it, but gave up when I realized I'd have to install a rectifier in the wall which just seemed like a fire waiting to happen.
I use these blocks from Sparkfun:
Solid State Relay - 40A (3-32V DC Input)
They have four screw terminals - two for 3VDC to control and two for 24V - 380V AC for the load. They have the CE certification.
I bolt them down inside a NEMA enclosure and use standard residential wiring techniques (buy a book or two!) to wire them to standard outlets, where I plug in the load.
The controller (Arduino etc.) is typically mounted in a small plastic box outside the NEMA enclosure with a terminal strip to attach sensors and so forth. It's powered by a wall wart.
This approach meets code and is perfectly safe. For level of competence needed - you should be capable of doing residential electrical wiring. That's a useful skill to learn.
You can use smart plugs like Sonoff S20[1] and flash your own firmware. They have the widely used ESP8266 inside. I use ESPurna[2] on them, which has many common integrations built-in (Alexa, MQTT, etc) and is very easy to extend further.
I've been looking into this as well since the time/risk/insurance issues of diy are kind of putting me off. The Functional Devices RIB (Relay In a Box) devices for ~$10 look pretty slick, only downside is 12v control signal. I ordered a couple to play with but haven't had time to install them yet.
#1 is my privacy.
I don't trust anyone else with my privacy.
I can do some stuff like turn on AV receivers and program them to do something automatically, like switch to movie mode if I stay in the room for 2 minutes (just an example) for example because each of my power outlet has an IR transceiver. Though I don't use them much, they have a lot of utility. The reason I don't use them much now is I upgraded my receiver and now I need to re-program the IR transceiver with the commands from the AV unit's remote.
With Google cloud, you can write your own Siri-like interface, so you can talk to any power outlets you want, which is my next milestone. Stuff like this would normally require different vendors to operate together (Eg. Nest + SIRI + Homekit) but because this is my own platform, I can do whatever I want.
I feel obligated to mention in every one of these threads the wemos D1.
I actually have a tough time explaining just how incredible this board is. You can program it in the Arduino environment, meaning if you are doing any hobby electronics, you're probably already really familiar with the programming modalities.
It comes with a programmer, and power regulator. No fussing with anything like you might have to with a bare ESP8266.
It also has WiFi. It is the magic internet of things that I swear everybody was dreaming about 5 years ago. Go buy 10 of them. They're my favorite favorite favorite general purpose dev board right now, and actually they're so cheap that I have no problem putting them into "finished products"[1].
[1]: I build custom/one-off large scale installation pieces and hardware prototypes. Almost every single one of them has an arduino-ish device in it somewhere.
I actually prefer the Wemos D1 Mini. The D1 you linked has the same header layout as the Arduino, which might confuse a lot of people that you can use Arduino shields. Some of them might work, but probably not without modifying the libraries for them.
The D1 Mini actually has it's own shield format, and several shields are available. Even experienced people will find value in the ability to just plug in a display, or other device and use already available libraries. Maybe not great for production work, but great for prototyping and learning.
I think the big downfall with any ESP8266 board compared to others is going to be power consumption, even with WiFi off. So anyone not plugging theirs into a wall should do some research in that area.
I just got into the micro controller world a few days ago and it's overwhelming how many options there are! Between the pi, the Arduino, the ESP8266, Wemos ans so so many more which all come in so many flavors it's really tricky to the "ideal" one for a beginner like myself. The project I have in mind would require to work on batteries as opposed to plugin it into a well. It sounds like you're suggesting that anything ESP8266-based would not be ideal not plugged into a wall. Could you share some pointers to what alternative might be better for very low consumption but still has wifi capabilities? Thanks a lot! I'll keep digging in the meantime, this is a fascinating world I'me happy to explore!
Depends on what you mean by "very low consumption". For one project I used a SparkFun SAMD21 Mini Breakout[0], and with the RTCZero[1] library was pretty easily able to get it down to 0.3mA when sleeping and averaging 1.3mA overall. (OK, I had to desolder the power LED which was eating 3mA.) I've since switched over to using Adafruit Feather M0 boards for most stuff, which is basically the same thing.
edit: Oh sorry I missed the "with wifi" in your post. One nice thing about the ESP8266 is that lots of people use it -- hopefully that means you can find details on how to run it in low power modes.
There are a lot of people who've shown how to use the ESP8266 powered off batteries for a long period of time. This [1] references a few and contains another itself. But they're not running all the time, it involves going in to deep sleep, and waking up very seldom.
If you don't need actual WiFi, and instead just need wireless communication, there are other lower power modules you can use like the nrf24l01, LoRa, and other generic "Wireless Tranceivers". If you need them to have internet access, you can create a gateway which the remote modules communicate with, then have a ESP8266 plugged into the wall to proxy the requests.
The uno format is exactly why I like it. It means I can use screw shields made for the UNO on it. Also lots of other shields that will accept 3.3v logic.
I give these away to local kids - on aliexpress $5 buys you a baggy containing a D1, a proto board, wires, resistors, LEDs, temp/light sensors, switches ....
Great value - program them as if they were an arduino
I'm using a ESP8266 board from a local shop, $17, I knew you can get cheaper on Ali but starting out I like not to wait and not worry so much about quality. However I will look into these for future boards.
I set up a thermal sensor that updates a Parse (remember them!) clone. Working well but sometimes it just stops updating, not sure if it is the device or the Parse clone's fault or a bit of both. But it works nicely for a day or so at a time.
Just a reminder things might not go smoothly with these devices, they are tricky to debug if they crash. When you are communicating via http the apis are not as nice as I am used to on the desktop.
The 'DevKit-C' breakout boards are $10 each from authorized distributors; they're a little large and you could probably find variations for closer to $6-7 if you went looking, but they're good for general-purpose stuff.
It seems like small power-efficient microcontrollers have made enormous progress over the past decade, and we have an opportunity for the PC revolution all over again. The ESP32 is a little bit power-hungry, but it's also a proper CPU; it has two 240MHz cores, a few hundred kilobytes of RAM, an extra low-power core that can wake the main system up from sleep, and an MPU that can keep track of 8 process IDs per core including 2 privileged ones. People used to make do with less. It also has WiFi and Bluetooth and these days you can even write programs for it in Python.
I'd love to see more people thinking about the problems in their lives with relation to a $20 bin of modern parts. Sensors, displays, and actuators have made similar progress, and the possibilities are endless. But the pool of people trying to realize them is finite and way too small.
If you search for "ESP8266" (especially on a website like hackaday.com) you will see a lot of projects using these boards or very similar ones. You can also look up the ESP32, which is the big brother of the ESP-8266 with Bluetooth LE, more CPUs, and some other cool features.
- Unless you are building something with high volumes (or something trivially easy), development costs are going to be your biggest expense by far, specially firmware/software.
- Using cheap parts is nice, and if you come from the DIY world you will know many such parts. If you are going to build something commercially, avoid those things like the plague, because they will become the biggest sinkhole of technological debt.
- Software/Apps behave like high-risk investments (natural monopolies, zero-or-nothing situations, low initial costs), electronics behaves more like long term investments (high initial costs, high development path dependency). It's way more profitable to have a product you barely have to touch (but sells well), than several that need constant modifications.
Which leads me to some tips:
- There's not much sense in 8 bit / 16 bit microcontrollers for most projects nowadays. Don't fear going to 32 bit.
- MIPS/AVR are nice, but if you are building something that is not a one-off (or you plan to build on the product), go with ARM (for now).
- Build your PoC and prototypes on manufacturer libraries, but once you have the resources for it, well-thought and tailored libraries will make your life easier.
- When working on libraries, don't write them directly from the datasheet. Go for the family references, target the whole family instead of a single chip.
- Before chosing any component, specially the ones that are hard to replace, price is secondary at best. Availability is way more important.
- If you are willing to take some risk, look at Rust for embedded. The language is still 'young' and there's a lot of stuff that needs to settle down, but man, does it look good.
And for PoC pick one with more memory - e.g. you can find chip (like stm32f0x1) with same pinout, peripherals - you can optimize that later, and don't worry about it while using fat libraries.
A MCU is sadly not a CPU, for example, most use the harvard architecture, meaning code memory is in ROM and uses a separate address space than data, which usually lives in SRAM. This limits a lot of things you could possibly do. RAM is also very very limited and you have to use it for any data you put on the stack as well as on the heap. You could however, emulate a very very weak and simple CPU on it.
I think it's a stretch to say "most [MCUs] use the harvard architecture, meaning code memory is in ROM and uses a separate address space than data" since I have not encountered so far not even one device (in the about a dozen or so that I worked with in real life) that actually had a different address space for RAM than ROM.
I will say that for the particular one that OP linked above, this does seem the case since the datasheet mentions "ll the 64 bytes data memory of PMS150C can be accessed by indirect access mechanism."
Your compiler or assembler might abstract it for you but most (basically anything smaller than an ARM Cortex-M) will have harvard architecture. Some MCU's ran run programs from RAM but IIRC they do it by loading RAM into Code Memory and then executing it, it looks like VN from the outside but isn't quite on the inside.
Harvard doesn't specify if you need an indirect access mechanism, plenty of HV computers can access their code memory fairly normally (either by using a special bit in the bus or opcode or mapping it into a unused section of normal address space). Harvard simply means that Code and Data come from a separate bus and in most cases that means separate devices.
If your MCU has two seperate specs for Flash/EEPROM as Data and Program Memory, then it's 100% Harvard. And that's basically most of them.
I am not arguing about the existence of Hardvard arch. on MCU's but rather on the fact that most of the time, RAM and ROM memory accesses happen in the same address space. For sure, the underlying HW might connect you to different buses, but on a lot of MCU's, from the programmer's perspective, the address space is a big flat area containing everything.
For sure, my experience has probably tainted my outlook. I have the most experience with Renesas MCU's and for example on them, I can surely run programs straight from the RAM, and depending what you're doing, you might sometimes be forced to do so. I worked with Cortex M also, and they're flat address space too.
I did check out the specs for Atmega MCU's and it seems those, as you described have different address spaces for data and code areas. What I want to say, I guess is that you can have a huge variety of options and architectural approaches for MCU's.
Surprisingly acceptable. The datasheets are reasonably legible and there's a weird but perfectly usable SDK. Padauk clearly don't care about the hobbyist market or more specialised applications that require certification or long-term availability, but their offering seems like an entirely reasonable choice for low-cost, mass-market products.
Having used half the IDE's this person outlined, I really really really really wish every single one had a "write Makefile" option. Maybe 1/4 or the IDEs I use do that successfully. I always end up using GDB for debugging, and then the IDE for asm-level tweaking (well, I don't do the tweaking, someone smarter than me does :), but I can do 90% of my work in GDB).
In the "real world" IAR Embedded Workshop is the hands-down winner (licenses are $$$$$$), which is unfortunate because despite being so mature it is awfully clunky.
Agree so much. Every project I run, I start off working with the available IDE (Keil, Eclipse) that the manufacturer likes and then take the effort of writing a Makefile for it. Absolutely hate dealing with IDEs and their buried settings! Terminal, code editor and gdb FTW :)
Yeah, I didn't know that existed but I created my own make environment a while back. My arduinos have been gathering dust for about 5 years, ever since I discovered the ST nucleo64 line ... 80MHz, 1M flash, 256K sram, 4 UARTs, 4 SPI, 4 I2C, 20+ GPIO, 4 ADCs for under US$15 ... I pretty much stopped using Arduino everything.
Me, too. But now that I've found the Teensy 3.6, it's my new goto. It's too expensive, but it has all the power. Also, I've been doing embedded for over 20 years and I'm starting to appreciate the simplicity of Arduino. It does get most of the job done. And when I had to modify the drivres, I was able to write completely low-level code. Only walls I've run into are tweaking the linker file. I haven't been able to locate that :(
As I have mentioned in the past, my discussions with people at Microchip and Motorola have conceded that with modern process technology the cost of the silicon is insignificant compared to the cost of packaging and testing. As a result you get to about $1/chip in singles as the low price cut-off but you can put an 8 bit, 16 bit, or 32 bit processor in there and it doesn't change the cost. It can cost more if you add a lot more FLASH or RAM. That takes up silicon real estate and is longer to test so it can reach the point where the dice is once again a meaningful contributor to the cost.
I guess that makes sense, and it's not a particularly new phenomenon. The MOS 6507 (used in the Atari 2600) was mostly the same silicon as the 6502 (as used in Apple II and many other places), but cheaper because it was in a smaller package.
The writer was on an episode of Embedded.fm podcast awhile back, one of the rare ones where they really get into embedded in detail. Good episode, I recommend it.
Two take-aways were that he just loved the Silicon Labs EFM series, which is a modern set of peripherals wrapped around an absolutely outdated 8051. For the most part micros are just moving things from one peripheral to another and that can work out just fine. It's nice SI used SWD/JTAG as the debug peripheral so you can program it along side all the ARM parts you're actually going to use.
And two... Having used almost everything on this list. I'm going to chose the ARM M0/M0+ 10 times out of 10 anymore. Maybe I prefer STM's peripherals to Atmel's event-eccentric, or whatever. I just can't honestly see starting a new project today on 8051, PIC16/24, AVR etc. Maybe it's what you're used to. Or maybe for someone making landfill-ready toys with razor thin margins, but I'm glad that's not me.
TI is still pumping out Zigbee boards based on it. I had to dig through documentation and tick a box saying I wasn't going to make missiles just to figure out what I needed to program it.
I'm kinda curious about 8051 chips. They're absolutely everywhere, although maybe now the Espressif chips are taking over.
I like the amount of support that ESP gets but would personally never use it because I told trust Chinese networking chips.
The 8051 makes absolutely no sense to anyone - except when you consider the extreme low cost.
In the example of the SiLabs parts, they took the modern peripherals from their ARM chips and plopped them down to a 8051 core. Some times that will work great, but if you are doing any “real work” (preocessing) on chip just go with ARM. But, he, sometimes you need to toggle some LEDs and write something out over SPI.
Oh, I really like his analysis on "Parametric Reach" for the various architectures:
> If you want to commit to a single architecture, it’s important to know which one gives you the most headroom to move up. I created a fictious “times better” score by comparing the the part tested with the best part available in the same ecosystem — this usually means fairly comparable peripheral programming, along with identical development tools. I multiplied the core speed, package size, flash, and RAM capacities together, ratioed the two parts, and then took the quartic root. Essentially, if every parameter is double, it is considered “2.0 x” as powerful.
I would love to see a comparison of instruction sets for assembly programming. Sure, only a few people are going to program in asm, but a microcontroller is the best way to play with it.
The MSP430 instruction set is somewhat friendly, but I long for the days of the Motorola MC68hc11. That was a beautiful instruction set, especially for teaching.
Does anybody know how these chips fare for raw assembly programming?
I'd guess that 8051 is the easiest. I suspect that a huge percent of 8051 is still hand-coded assembly. It has an accumulator architecture and the instructions were made with hand-coding in mind (plus, there's not very many of them). I remember it being pretty easy to learn, but that was a long time ago. To me, RISC assembly tends to be quite a bit more complicated to write by hand.
The AVR instruction set is reasonably nice for hand-coding (and has a more modern feel to it than the 'HC11, which may be relevant if you're using it as a teaching example). I haven't used PICs since the PIC14 days; it was a painfully minimalist ISA like the 6502; the newer PICs are better, I gather.
The ARM set isn't unpleasant but it's definitely a modern set designed as a compiler target rather than for hand coding, and most ARM chips are large enough there's no real reason not to use a compiler for almost all the code.
I'm playing with the PIC10F320 at the moment. Minimalism is fun. $0.50 in 1 off quantities. 6-pin SOT-23 package. 16MHz. 0.5K of program space. 64 bytes of RAM. Waveform generator. ADC. Timers. PWM and the coolest thing a configurable logic cell which works while the CPU is asleep.
I've got a semi-working morse iambic keyer in that and it uses 40uA of current running flat out. I'm working on sleeps now. I reckon I can get it down to 100nA average based on the wake time and 20nA sleep current. I can't actually measure down that low even with my 5.5 digit HP 3478A
We use these development boards in combination with freeRTOS (bare C based) for lots of projects in our lab that require high sampling rates (e.g. 8 analog sensor readings at 1 kHz) motor control loops etc.
There is a very good blog on these chips at
mcuoneclipse.com
I like MSP430 a lot but the tooling leaves a bit to be desired. Maybe that's been improved upon recently by TI but a few years back you were left with few choices other than installing some kind of IDE on Windows.
TI distributes a pre-compiled version of GCC [0] for the MSP430 along with a command line MSP-flasher [1] utility for flashing code to the device. It all works really well on Linux. I haven't had to touch any of their windows tools. It can be slightly confusing getting started because there are 101 different ways to develop and compilers you could use so you have to wade though examples that may not be applicable to your chosen development environment. Once you get past that it isn't hard. I really like the tutorial series on simplyembeded [2] they to a great job of covering the MSP430 basics.
Amazing article! (I was utterly unaware that this amount of choice and selection of microcontrollers exist, much less at this price point(!) -- before having read this article... you put a lot of work into this article and it shows.)
This will be my new, first, go-to article, if I begin any new projects involving microcontrollers in the future...
I very recently started getting into microcontroller programming, and have subsequently purchased a plethora of different ESP chips on Banggood for roughly $3-8 a pop (though all of them have WiFi built in, and a few even came with cameras).
I would actually be curious how these controllers compare to a $1 chip.
It is really mind-bogging how fast processors are these days. A few days ago I read the marketing copy for the iPad Pro on the Apple website, where they said that their neural processor can perform more than five trillion operations per second. Initially I thought they translated it wrong from English to German (one trillion is "eine Billion" in German), but I rechecked it and it seems correct and actually makes sense for a highly parallel architecture that runs at a few GHz per second. Granted it costs more than $1 (though the production cost without factoring in R&D might actually be in that range) but it's still amazing that you can just carry such a thing around in your pocket.
"Microcontroller" refers to everything on the chip (usually, we would talk about it having a "core" roughly akin to memory + ALU + such, and "peripherals" which are on-chip dedicated hardware that migh be eg. I2C or USB communications, timers, ADCs, etc). What you're linking to we would call a "development board" (dev board), "demo board", "eval(uation) kit".
I don't consider the title misleading, as the article is aimed at the people who are designing their own (hobbyist probably, but not exclusively) boards, and will be integrating the chip, not a dev board, into their project.
Yeah, I probably wouldn't be concerned about the cost of the actual chip but rather the cost of w/e dev board I would need for my hobbyist project. Maybe the complexity of wiring everything up if I were to put the microcontroller on a custom designed PCB.
Those Infineon chips are incredible for how inexpensive they are. I've worked with an XMC1400 at work (another one of their M0-based offerings) and it was insane how sophisticated the peripherals on those things are, despite being a dirt cheap part.
That said, their IDE sucks (well, every manufacturer-provided IDE sucks, but whatever). Life is way easier with a couple makefiles and Ozone.
This is a great round up of cheap microcontrollers - I would love to take that approach of "scoring" peripherals to be able to compare various vendor's offerings up and down the lineups!
As of right now it is hard to compare families at the start of a project, most of the time we just go with what we are comfortable with (and haven't been burned by in the last project!)
What I really would like to see is some more competition and price drops in displays. These microcontrollers are awesome and I love building small hardware projects. But the output systems are usually pricey. If color (ideally touch) displays can be made available for $5-$7. That would open up a flood gate of opportunities.
Color displays are available for $5-7, although they are usually only 2-4" diagonally with up to 240x320 pixels at 16-18 bits of color per pixel.
But it definitely did open up a flood gate of opportunity. You see ILI9341 and ST7735 TFT displays all over the place, even if they're a little too small for large pieces of equipment.
Not to mention the explosion in cheap individually-addressable color LEDs and drone-driven advances in small DC motors. It's fantastic, you can pretty much just plug electronics together like Lego bricks at this point.
One of the most common outputs is relays, thankfully those are pretty cheap. Displays are getting close your price which is great.
Depending on what you're doing you may want to consider purchasing something like a kindle fire for 50$ though and rooting it. Or even a pre-paid "smartphone" for under that much. Then use a microcontroller with it for GPIO.
I started learning embedded programming on ATMELs and to this day they are still my favorite. Solid documentation and pretty good command line tools when you don't want to use an IDE. Also you can find them sometimes in a dip package which is handy for prototyping.
>The Renesas RX200 family would be a nice addition to the list.
Can you show where you're finding RX200s for under a dollar?
Because... I was interested having never seen almost anything from Renesas near what I would consider a good deal. I can't seem to find anything even close [0] this being the cheapest RX200 chip I could find at $1.70 @ 5k [1]
Anybody know any awesome cheap Raspberry Pi Zero W alternatives? Primarily looking for something ultra cheap, tiny form factor, not especially power-hungry, able to run not-too-weird flavors of linux, and preferably with (wireless) networking.
Would only make sense as an art project, imo.
If you want to run neural networks on micro-controllers, one ARM Cortex M4F (or M7/H7) will get you pretty far. Audio Classification with tens of classes, as well as low-resolution image classification.
And the ESP8266. Not as fancy but it's half the price. I love both the ESP8266 and the ESP32 a ton. They really made wifi projects "cheap" for entry-hobbyists instead of some 70USD wifi shield.
I picked up a few ESP01 boards from Aliexpress recently, they're less than $1.50 each. They only have two GPIO pins accessible (and one needs a pull-up resistor to make the ESP8266 boot properly) but for toggling a relay or reading a simple sensor over wifi they're hard to beat. They're even powerful enough to run a basic HTTP server to handle a light web interface for the GPIO.
is it possible to somehow buy this off-line in person in mass quantities? seems like it takes ages to ship from alibaba, also I'm afraid of the Chinese government tapping my phone (as I suspect happened on WeChat I foolishly installed, literally seduced by this Chinese chick who claims she's in Vancouver but then doesn't know where Surrey is???? red flags) potentially, so I want to tinker with these interesting DIY projects and get started with soldering and PCB etc., but I always can't be at complete comfort (I am well aware and conscious of the fact that my privacy standards are in the extremes), knowing what I read on HN all the time, maybe it's a good time to take a break.
So I would really love it if somebody could sell me large bulk of various stuff like this that you could literally get from Alibaba in some vain hope that some wholesale buyer/middle man can make a premium off this paranoia, I'd gladly pay $3~$4 for this if it meant that somebody bought like a million of these for $10,000, and then sold me a chunk of that (at a markup of course which I'm more than happy to pay for the same reason people use VPN and Incognito or Tor), why not for electronics?
tl;dr: Looking for somebody to start a wholesale brick and mortar business based on DIY electronic parts like this so I can pay with cash to escape suspected foreign state surveillance.
Imagine a younger, ambitious, slightly politically sensitive you from the past, expressed a common consensus held by a specific group of like minded peers who believed that a certain country Brad Pitt made famous in the 90s should be free to exercise their political, religious and cultural will against an aggressor state, those things suddenly attract the wrath of peers from that said aggressor state, who think very differently from us, things escalated and I'm still to this day freaked out and feel tense when I hear people speaking the official language of said aggressor state. Call me disturbed, paranoid, I don't care, you weren't there man, you weren't there when the Charlies flanked us and got embassy involved. What is this...People's Republic of Vancouver?
Pretty near all of this stuff is available from North American distributors, Adafruit/Sparkfun for more hobbyist-minded stuff, Digikey/Mouser/Newark for industry. Adafruit takes bitcoin if you're that paranoid.
You're going to have a hard time getting along in the current world, especially in electronics, if anything Chinese sets you on edge though. I'm trying to be gentle, and I know you didn't ask for advice, but consider some counseling if you're "freaked out and feel tense when [you] hear Chinese people talking in Mandarin". Sounds like you're dealing with some history that you could afford to talk to somebody about.
I am considering laying off the ganja for a while. but I need it to meet deadlines, to do the work the market demands at the best possible time to the best possible consumer, I am the invisible hand that keeps pushing me, in this struggling and character building times. thanks for the advice 친구!
I know unsolicited advise is often not appreciated (for good reason sometimes), but perhaps you need to work on a better work-life balance. If you need weed to get through the day and meet tight deadlines, perhaps you need a less stressful role. Personally, I've cut back on the hours I work for this reason. Sure, I earn a lot less, but I'm much less stressed, happier and am starting to get my life (physical, mental and social health) in order.
PS: I buy most of my electronics from mouser or if its a hobbyist pre-assembled item, sparkfun/adafruit. I am just a hobbyist, though.
Those usually can't even run a linux kernel, so you directly compile your program in C, you run it and that's it.
It's very light on power, which mean can be turned all day without worry.
To be honest I don't know how I would use this, because it's really really minimalist, doesn't have wifi, not enough memory to run a lightweight webserver, too slow to run a python interpreter...
I wish there was something in-between a micro controller and the raspberry pi, so I can just run a minimalist webserver with some SSH, no usb plugs, only wifi. The raspberry also must also explicitly sets the SD card as read only, because it has a limited lifespan.
The rpi is cool, but I wish there was a cheap, entirely open smartphone, that should be the next step... I guess there is a market for it, geeks would really buy it. I'm not a fan of building android apps, and most smartphone specs are way too fast and expensive for what I would do with them.
Last year, I started out to digitalize my entire house with these tiny ATTINY 85 chips and with some nrF wireless chips. It has worked really well for me and I'm able to control and monitor any power port in my house as well as my mains.
The overall setup still costed less than a Nest, yet, vastly more powerful. Of course, the downside is you need to write code, have a running server to control it on the cloud. But, no problem for me as I'm a (Google Cloud) consultant and this is what I do for a living.
I use Google Cloud's IAP with AppEngine (I may switch to cloud run now, since it's cheaper tho) and I have a private REST server running that I can access from my own Android app.
The whole thing took me a year to finish, but that's because I worked on it maybe once or twice a week in the weekends and didn't focus on it much.
But, my effort has paid off and it's amazing to me that what is possible with just a dollar investment.