Hello everyone!
I don’t know what category this message should go into, because it’s a general query and also because I’m new to this world called Home Assistant.
It would be cool if there is a section to introduce yourself and give the first more general questions like the ones I am going to do in this post:
Very recently Arduino released a new piece of hardware called the Arduino Giga R1 Wifi and it looks amazing.
I ask: How can I make Arduino work with Home Assistant and with the obvious purpose of making home automation of all devices and machines through this device with relays?
I ask: What compatibility does HA have with Arduino Mega? That is another option and it is what I can currently achieve in Argentina.
I know they love ESP32 a lot, but as a beginner I want to start with Arduino and then when I have enough experience I’ll go for ESP32 or a more advanced and powerful microcontroller.
I leave my doubts and I remain in the hands of all the members of the community to learn. Move this thread to where it best corresponds and at the discretion of the moderators.
Excuse my level of English when writing, I used google translate because I still haven’t mastered writing English by heart, although paradoxically I can read and understand the language.
I send you all my most sincere greetings and I await your answers. Thank you.
Thank’s to esphome the easiest and most straight forward way is to directly use esp32’s or even esp8266’s because they tightly integrate with home assistant like no other micro controller.
Starting new projects with arduinos in 2023 without a particular reason (hardware requirement) doesn’t make much sense in my opinion. ESP’s are not only (much?) cheaper but allow easy OTA programming/upload thank’s to the native/integrated wifi
This forum has a dedicated esphome category in case you want to dig deeper and have questions
The Arduino Giga R1 is a dual CPU system with a Cortex M7 at 500MHz iirc and a second Cortex M4. It’s much more powerful than an ESP and closer to something like a full blown SoC SBC. It’s pretty expensive though.
This Arduino (like most of the older ones too) are development learning platforms. So learning how to actually program microcontrollers is a good reason to use them in 2023. You don’t learn anything with ESPHome. You just write or copy’n’paste a config file. The Arduino platform, even the older ATMega based ones (they’re still good for very low power designs and battery powered sensors) are great tools for learning about embedded firmware development. While you could also do this with ESP and their C/C++ SDK, the Arduino HW platform is much much better documented than anything from Espressíf if you want to deep dive into low level register based development.
If you don’t care about all that and just want something cheap, programmed for you and that works with HA natively, then by all means ESPHome is good for that. I would stay the hell away from ESPs and use an RP2040 based Pico W though, but that’s personal preference.
@smallfry83:
Do you actually want to learn how to program an embedded system yourself and make it work with HA, or do you just want to build a device and have it work with HA with the least amount of trouble, but without programming it yourself ? And are you aiming for battery powered devices or do you expect them to have a constant power supply ? That will change the way to approach things.
Hello HeyImAlex!
Here I answer and sorry for the long message.
What I have been looking for for a long time is to work with Arduino to create my home automation with my own hands and learn a lot. Learn to program each element, each thing that I want to be automated, with the graphic help of Home Assistant as a dashboard. I really like to learn and that exercises your brain.
I have an old computer that still has power for a while and use it as a Home Assistant server, and use the Arduino to execute each of my house commands.
For now I am going to use that computer with a few hours a day working to learn a lot and go designing what will be in the future in my dream house later (which will be a very large and very modern house) and that house will be automated by me with my own hands.
I was looking to automate but also learn a lot from Arduino. I never bought it and as you can see, I live in a country where the economy is not good and it is difficult to save to buy things.
As the new Arduino hardware came out very recently and with very interesting features such as a greater number of GPIO ports (75) and a little more internal disk (2 MB) which in my opinion still falls short there. While I wait for the latest hardware to come out in Argentina, I’m going to save a little to get the Arduino Mega to start with and some multiplexers and a 16-port relay to cover various appliances, alarms and lights.
You should know that I was studying a lot about Arduino a long time ago, reading on the internet, but I didn’t buy it because I had to put it off again and again because I had to choose priorities on what to spend money on, as I said: money in Argentina is not enough.
I hope my answers to your questions can pave the way for where I want to go.
I send you a sincere greeting and I await your response.
Keep in mind that this new Arduino Giga R1 is a completely different thing than the old Arduinos, like the Arduino Mega. It’s on a completely different level and development for it will be very different. It’s a modern platform based on the STM32 microarchitecture with two ARM Cortex cores and a Cypress Wifi/BT chipset (the CYW4343, the same as used in the Raspberry Pi line). That’s very good hardware. The STM32 platform is an industry standard and it’s the type of hardware that is widely used in the electronics industry when building actual consumer electronics devices. So if you want to learn ‘real’ modern embedded hardware and software development - high and low level firmware design, performance and low power code, JTAG debugging, etc - then this is a good setup.
However. For typical sensors and devices you’d use for home automation, this platform is complete overkill and far too expensive. You won’t be buying dozens of those to create, for example, temperature sensors. That would be a waste. There are better suited platforms for these (Older Arduinos, RP2040 / M0+ boards, ESPs, SAMD boards, etc). I personally like the RP2040 for this (for example in the Raspberry Pico, with or without wifi), which only costs like $5. But in the end this depends on what exactly you need. Picking the right hardware for the job is part of the learning process.
Question. How much experience do you have with programming in general (even on PC) ? Do you know any programming language and if yes, how well do you know it ? If no, how much time are you ready to invest in this ?
As I said in the last post, although I’m fascinated with the new Arduino released by the OEM, I want to start with the Arduino Mega and then I’ll jump on the newer one maybe next year.
Regarding your questions:
I know little about professional programming, the closest thing to programming things was doing small programs in Visual Basic a few years ago (in a very modern Visual Studio) and I fell in love with that language because of how easy but powerful it is.
Sometimes I thought about creating all the software with VB to automate a house and use Arduino to execute the orders, but when I found Home Assistant on the internet I decided to go for this software because it is very complete, versatile and useful. In addition, Home Assistant saves me hours and years of programming something similar.
I am willing to invest all the time in the world to learn the Home Assistant programming language, the Arduino IDE programming language to control everything. I have no problem and as I said before, I like to learn new things that open your mind.
I still don’t know if you could answer my original questions about whether it is possible to use Arduino in Home Assistant. And the question about the compatibility of Home Assistant with Arduino Mega today.
It’s not that I’m obsessed with Arduino, but it’s what I wanted to use and learn the most, with all the world of sensors you can use. I have seen videos on Youtube and I have read a lot, but I hope you can answer the third point.
I understand your comments and your message. However, my preference for Arduino is because it has more GPIO ports than ESP32, and my home automation design is pure learning. I want to learn everything and I don’t mind the idea of spending time pecking at Arduino IDE code or generating code in Home Assistant to make something work.
Maybe later I’ll go for ESP32, but I always wanted to experiment and learn from almost scratch.
Despite the shortcoming that Mega has, for example, in that it does not have as much internal “disk” space to save code as I would like (because I dream of automating many things in a big house), it is nevertheless the ideal starting point to start my home automation adventure
I was waiting for the answers I’m looking for about the compatibility of HA with Arduino, consulting users and their experiences with that famous microcontroller.
I really appreciate your particular recommendation of ESP32 and I will keep it in mind in the future.
Older Arduinos based on the ATMega processor family can only be programmed in C or C++. The new Arduino and other ARM based microcontrollers can be programmed in both C/C++ and Python. That’s why I was asking about your programming experience. Professional embedded development is done in C/C++, because this gives you full control over the hardware, has no external dependencies and gives maximum performance. It also requires you to know C or C++, which are not known to be easy languages to learn (especially C++ is probably the hardest to learn language on the planet). Python is the easiest. So you may want to choose your microcontroller platform based on this too.
Of course it is possible to interface an Arduino with HA. I have plenty. But here again, there are lots of different ways to do this. TCP based (wifi or ethernet), MQTT, Firmata, Websocket, HTTP REST. Or RF link based with a myriad of different protocols and modulations, RS 232 or 485, CAN bus, etc etc. That’s the thing when you design everything yourself. The sky is the limit, you have all the options. The downside is you need to know how to deal with them. It all depends on your use case. Power consumption (battery vs powered), network limitations, wireless or not, etc.
But yes, it is absolutely possible to connect an Arduino with HA. It is possible to connect any microcontroller to HA if you have control over the firmware.
Python I have seen it on the internet but I still look at it shyly. It’s like seeing something new out of the corner of your eye in a store that calls you but you don’t dare! Ha ha ha
I see C and C++ for another life… too complex to master. Although, a while ago someone on the internet told me about C# saying that it is similar in syntax to the VB that I love. But I’m still researching that language, I’m still seeing information about it until I’m sure it’s what I’m looking for, well, I have to move on to something more current in some half-distant future.
But let’s get back to reality, let’s get off the cloud.
Since I want to use HA as a dashboard with Arduino (with multiplexer and relays, sensors, its entire universe), a few days ago I was investigating the possibility of using MQTT, since another option like Firmata, for example, does not work because it is outdated and without further maintenance according to my research that I did a while ago when I met HA. Firmata has not been updated for years since 2014 according to the following link.
Regarding TCP, I prefer it with ethernet wiring, not wifi. I can speak with TCP property because I have made networks at home to have internet.
I ask: What do you think of MQTT? And what do you think of my choice of TCP ethernet (wired)?
As you said, I want to have control of everything I want to do in HA with Arduino and as you said, control over the firmware. I will continue investigating the other data and options that you mentioned in your last message.
The sky is the limit and that seems wonderful to me.
If you want to use older Arduinos (Mega, Due, Nano, Pro Mini, etc) then you will need to know at least a little bit of C. But it’s only a small subset typically, you should be able to pick this up on the way. The Arduino Giga and the Raspberry Pico (W) (and maybe the ESP, I don’t know, I don’t use them) can also be programmed with MicroPython. Personally I’m not a big Python fan (I’m a professional C++ software engineer in my day to day life), but Python is going to be a lot easier to learn if you have no C background. So I would suggest going into this direction.
C# is a language that depends on a massive runtime backend (a bit like Java) and is mostly used for application development. It’s not designed for embedded microcontroller programming.
I love MQTT. My entire home automation backend is based on MQTT. In my opinion it’s the most elegant, flexible and future proof way to connect IoT devices. And it’s perfectly integrated with HA.
Oki doki, I’m going to learn the basics and necessary in C for Mega, I have no problem doing it. Keep investigating.
When I can buy the new Arduino released a little while ago, I’ll switch to MicroPython and give it atoms!
The C# thing was a comment on my part so you know how far my interest in programming languages reached me. As you well say, that language is for another type of use and therefore, it is not used in what concerns us.
If I have any questions about MQTT, I’ll let you know. I’m glad to have you since you love him.
Yeah don’t worry too much about it. You’ll only touch C/C++ on the surface for Arduino sketches, it’s not very complicated. The actual nightmarish demon sleeping below the C++ surface is usually not something used in code like that
Good luck and don’t hesitate to post your questions here on the forums. Lots of people around here use MQTT and we do have some Arduino devs too !