8 ms·
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 ID
by neya 7y ago
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.
- stevetodd 7y agoDo you have any write ups or code on this to share?
- praveenster 7y agoThis 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?
- kickscondor 7y agoTotally 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!)
- penagwin 7y agoHow 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....
- danieldk 7y agoHow 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.
- penagwin 7y agoYeah 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...
- blhack 7y agoDon't you have to run power to the blinds to run the motor to move them up and down anyway?
- dhruvkar 7y agoSounds fascinating! >> yet, vastly more powerful What's sorts of things can you now do with this setup?
- neya 7y ago#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.
- penagwin 7y agoWhat'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
- neya 7y agoIt 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..
- so_tired 7y agoThis is such a great setup. 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..) Have u thought about this ? Has this approach been explored ? great project..
- HeyLaughingBoy 7y agoThere'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.
- penagwin 7y agoI'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?
- mikepurvis 7y agoThere'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: https://sense.com/ https://sense.com/
- 83 7y agoAs 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?
- neya 7y agoSure. 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. The tricky part is component layout since you are dealing with high voltage, it can form arcs: https://www.youtube.com/watch?v=MAlyEMQxTN0 https://www.youtube.com/watch?v=MAlyEMQxTN0 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.
- danieldk 7y agoMy 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?
- penagwin 7y agoI 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.
- danieldk 7y agoI do like them, I have a supply of Wemos D1 Minis ;). I also like the Robotdyn Blue Pill (STM32, fun for playing with Rust). Regardless, I find the minimalism of the ATtinies interesting too, but haven't made the plunge yet.
- ChickeNES 7y ago> 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.
- unwind 7y agoFor 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. :( 1: https://www.aliexpress.com/item/32839140960.html?productId=32839140960&productSubject=STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-DIY-KIT&spm=2114.search0104.3.1.50e44caaZiIJL5&ws_ab_test=searchweb0_0,searchweb201602_10_10065_10068_319_10059_10884_317_10887_10696_321_322_10084_453_10083_454_10103_10618_10307_10820_10301_10821_10303_537_536,searchweb201603_52,ppcSwitch_0&algo_expid=79e6ec26-5106-483c-8f45-30fe7203b30a-0&algo_pvid=79e6ec26-5106-483c-8f45-30fe7203b30a&transAbTest=ae803_3 https://www.aliexpress.com/item/32839140960.html?productId=3...
- yeahitslikethat 7y agoI'm doing the same thing now. I bet your people think you're as crazy as my people think of me. My other friends are spending thousands of dollars retrofitting lighting and everything when they could spend a fraction and write some code. And learn a skill. And not have their privacy invaded. And have more money they always complain about not having enough of.
- neya 7y ago> 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.
- yeahitslikethat 7y agoMe 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.
- voltagex_ 7y agoWhat's your hourly rate? 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.
- yeahitslikethat 7y agoInvest those extra hours inventing something! :) Then you can sell your hours over and over again.
- nerfhammer 7y agoI've been using the attiny84, iirc attiny85 doesn't support the lowest of the low power modes
- tmaly 7y agoWhat does your programming environment look like for programming these chips? Do you have any blog posts showcasing your project?
- neya 7y agoJust Arduino. >Do you have any blog posts showcasing your project? Started writing today. Haha. I will share it on HN once done.
- saagarjha 7y ago> the downside is you need to write code You might call that an upside!
- merpnderp 7y agoHow 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.
- lstodd 7y agoThere are basically two options: - learn how to and design a PCB with relays or FETs or whatever, following all the best practices for it to not catch fire. - buy off-the-shelf rail-mounted relays/contactors, then design a driving circuit that will be all low voltage. Assembling it all on a breadboard won't cut it (as in will blow up sooner or later), that's for sure.
- wrycoder 7y agoI 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.
- mopsi 7y agoYou 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. [1] https://www.itead.cc/smart-socket.html https://www.itead.cc/smart-socket.html [2] https://github.com/xoseperez/espurna https://github.com/xoseperez/espurna
- 83 7y agoI'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.
- cr0sh 7y agoAre you in the United States? 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?"...
- mylons 7y agodoes insurance feel the same way about a Nest and other commercial devices that are already available?
- asteli 7y agoA 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.
- 7y ago
- amingilani 7y agoWhat? 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.