Holy Grail Of MCU's

I was thinking the other night how great it would be to have an MCU that had these capabilities:

  • Compact
  • Affordable
  • Ethernet connectivity
  • Passive/Active POE
  • 4MB+ Flash
  • 48 MHZ+ clockspeed
  • Optional Wifi (not really a need with Eth)
  • 10+ useable GPIO pins

If you think about it, 95% of the devices you have required a DC current and most of the time within the house that’s supplied from an ACDC adapter, that requires a wall socket. Why not just use PoE with 5-6v and a splitter?

I have seen a few ESP32 units offering as such, but at a considerable price, and to be honest, the ESP32 is a beast and is really overkill for most basic home automation tasks.
An IC like an ESP8266 / ESP8285 or the SAMD21 would be great for most things I would think.

I have been contemplating building my own module with an ESP-12, line driver and magnetics chip, and just splitting the PoE out or look at an active circuit.
Currently, I am just building a basic system with a PoE splitter to ethernet module SPI connection to an ESP8266. It’s bulky and if it was all on the one PCB it would be 2-3x more compact.

Have any of you found anything like this (with the “affordable” in mind lol)? or is it even worth putting the time into designing something like this?

The wesp32 looks promising if the price comes down a bit, I didn’t realise that the ESP32’s have dropped a fair bit in price anyway, with the additional GPIO’s and for only 10AUD its a pretty good option now. especially if you factor in how many GPIO’s are required when connection to Ethernet.

if they can get the wesp32 down to $20-25 it could make a perfect option. I also noticed to can get ESP32 dev boards with Eth on for less that 15AUD, they are just rather large.

I guess the advantage of using the ESP32 is i think it has default Eth MAC addressing, most other ESP’s I dont think have this by default.

The Olimex ESP32-POE is available for around $20 USD which I think is around $30AUD (CAD and AUD are usually pretty close) The only real problem with it that the wesp32 fixes is that you can’t use the USB port and POE simultaneously. No power isolation. So when programming over USB you have to use an unpowered ethernet port.

@DavidRK The ESP 32’s are getting even cheaper. I picked up 10 Devkit V!'s for $46 US from Ali Express 2 weeks ago, including shipping. You can get the Wroom chips themselves for a buck something a piece so the cost is coming down. I was looking at that for my package vaults and just because the devkit boards are so inexpensive, I went with the full board. I can header it onto an add on board to do anything additional. But yes… overkill for most things home automation.

Got me some ESP32s on the way, I have a few Eth modules hanging around so I will try making up some ad-hoc PoE controllers.

@polargeek I have ordered one of the Olimex to see how they fair and possibly in a few weeks I’ll order a wesp32 on their next round, compare the 3 for price/performance/ease.

The main goal is for a room monitoring system I have on the cards, it will comprise a range of sensors for each room in the house to give telemetry (light, temp/humid, activity, air quality).

The WESP32 is nice but at $73/ea it is a bit above my budget. The ESP32-POE-ISO from Olimex is a much better deal. It is the upgraded version of the ESP32-POE with isolation. It’s a bit more expensive but nothing like the WESP32. Personally, I am exploring using the Orange Pi One. Delivered they cost $13 and they have onboard Ethernet and Raspberry Pi compatible header. I also just found out that the orange pi zero, the baby brother to the One, has POE. I’ll want to check that out more thoroughly. They also have several sensor packs, if you are looking to make a sensor array of some kind, The sensor packs are a great deal and come in different flavors (sound, weather, etc) or all of them for $27. You can find all of the Orange pi boards at Aliexpress https://www.aliexpress.com/store/all-wholesale-products/1553371.html?spm=2114.12010612.0.0.5d69395cI5oeW4

The Orange Pi stuff is interesting but those are more SBC like Raspi’s or Tinkerboards than they are MCU’s like ESP’s and Atmega’s correct?

@MisterFixit1952 Did a little research on that POE option. It’s not real POE. There’s pads you can bridge if you send 5v passive POE. If you wanted to do higher voltage you’d have to wire a buck convertor inline and I’m not even totally clear on how you would wire in an IEEE 802.3af regulator if you wanted to do proper negotiated POE voltage you’d be better off using the same active POE splitters I use for my raspberry pi’s

Think I will put my room hub idea on hold for a few months until I can make my mind up with what path I go with, I will at least test the wesp32, Olimex and my own passive modular approach to get the firmware sorted and get a feel for the hardware.

Hopefully, prices come down a bit by then.

I also want a cheap solution to put into every light switch and outlet box in my house. $2.50 per board cheap. Impossible? The idea is to use Atmega48 (baby brother to the Arduino’s Atmega328) based boards over RS485 and Cat5 cable. Fortunately I had Cat5 installed when the house was built. Just a very simple board with a relay and a peripheral/sensor port. I call these “Minion boards” under control of the Despicable Pi :wink: Ultimately I want the minions to be be free-thinking in a peer-to-peer network but don’t tell the Pi.

RS485 is much cheaper than Eth but the Max485 modules still add cost. So what I’m working on at the moment is a differential interface using 2 pins on the '48 chip inspired by the V-USB project. No reason the technique can’t also work on an ESP01 or ESP12 or ESP32. Early days but will report back progress.

I’m not against Wifi for Home Automation but I want to use it as a cable replacement and not the main transport where possible. So the “old school” architecture allows a Minion to talk over TTL Serial (10 cm), V-USB (5m), Wifi (25m), DMX (50m), RS485 (100m), Ethernet (100m), LoRa (1 km). It’s like a tiny network adapter for the module. V-USB works. RS485 next.

For power I use the PoE lines on Cat5 cable but only at 12V to 24V max so I can use a cheapy switch mode regulator module. Considering putting 5V on the Tx pair (only using Rx pair for comms right now) and skip the SMPS altogether. A linear regulator will do.

So yeah… holy grail stuff for me too and hoping to pull it off (with the SH community help).

@Rudshep … Curious to know what protocol you’re planning on running over the RS485…

Until I can decide on something better, I’m presently running a roll-my-own minimal transport frame around MQTT messaging — which happens to be what all the devices in my system end up connecting to, one way or another. Though the current 5-byte collision detection window bothers me somewhat… On the upside,

I’d prefer CAN, but it’s small message size (especially carrying rather long-winded JSON MQTT messages), makes that option kind of painful… Knowing that the message will at least arrive in one piece, means a little EtherTen can quite happily process a multi-kb JSON message, with a simple state machine picking out the bits it cares about and ignoring the rest. That falls apart somewhat with the possibility that two or more messages may end up getting interleved due to the dinky 8-byte data packet limit. [edit: wrong inter-whatsit-word]

I regularly shudder at the idea of using a 32-bit monster to control a relay, or read the state of a switch. I’m struggling to resist the move to ESP32’s and the likes, and most of my DIY toys are still Arduino based — hence my delving into RS485. But there are two major issues there…

Firstly, I would like over-the-wire updates… It’s on my TODO list, to look into Arduino boot loaders that update off of SD card (if anyone knows of a good one) — I’d think, in particular, it should detect an image on SD card, verify the integrity (mostly just to make sure the image isn’t truncated or something obvious like that), preferably verify that it’s not the one presently loaded already, and then load and boot the new image. It would then be the job of the program to receive a new image, write it to the card, and trigger a reset. The ability to select a second fallback boot image if, say, a GPIO pin is held during boot, would also be of benefit to make recovering from a broken update sane.

And secondly, what I really don’t get, is why having Ethernet support so often costs more than most other entire development boards? I suppose the benefit of the ESP32’s, is they’re large enough to simply toss the entire networking stack and everything else in alongside the program you’re writing; point in fact, is the EtherMega I have sitting beside me, with a USB chip, and an Ethernet chip, both of which are somewhat more capable than the rather dinkly little ATmega holding my program.

On those grounds, I have to confess I’m slowly coming around to accepting the 32-bit monster for my 2-bit programs, if it means that one chippy can do the lot (especially if there’s room left for a bit of crypto goodness, which so far has been depressingly absent)… But, I’m most definitely wanting wired, not wifi, for most things… So the regular ESP’s are still a no-go for me without the addition of some kind of wired networking.

Soooo… my list, ends up being much the same, except I don’t so much care about Ethernet, since RS465 will do, and cheaper, but I do want OTA/OTW, preferably without having to cut the available program memory in half since it’s typically a little on the limited side as it is.

I got into this game just as the ESP stuff became a pretty common addition and I looked at Arduino vs ESP and just decided that there was no reason for me to go with Arduino because to make an Arduino do what pretty much ANY ESP chip could do was 5 times the cost. I do wish there were some affordable eth enabled hardware based on ESP’s as I would prefer to have a bunch of my gear hard wired but shielding up an Arduino just doesn’t make sense after crunching all the numbers. I would rather have a Ferrarri idling in the driveway with a $100 car payment than a Ford Focus with a $400 car payment. I love the Ether-boards that Jon has created but I can buy 10 ESP32’s for that and still connect them to the network.

2 Likes

Yeah also getting to a similar conclusion. ESP is getting cheaper than AVR.

I still prefer a wired connection in some cases though and the Wifi seems a waste. Like not living in a house with 100 localized 100mW microwave radiators cooking your brain 24/7. I mean really… 9600 bps is more than enough to switch a light bulb and I need to run DC power to a “wireless” board anyway.

Adding the Ethernet PHY and PoE is where the cost comes in and that is the reason I’m looking at RS485 or 1-Wire or a hybrid (or something completely different).

But here’s an idea… what if there was a LoPHY to work together with WiFi? A low speed, low cost wired interface that can talk 50M and switch on the WiFi for the high speed stuff on demand. Over 2 wires. Maybe even over Mains. Did I just invent X10.802.11? :joy:

Likely not… there’s a reason Wifi HA solutions are winning the battle. Cost-to-feature ratio is definately a big factor. Ease of installation is another. Need to beat that first to get to the Holy Grail of MCU stuff.

Rudie

I’m back lol, to much work on atm and had pushed my projects aside.

I have picked up a load of MAX485 chips, super cheap china shipment. the only issue i have had so far is I have switched most of my devices to micropython, when using the UART on the ESP8266 you share it with the micropython repl. So most of my long distance devices are an ESP32 brain with cheap nano or esp8266 just programmed with arduino acting as childs in the remote areas.

If a cheap POE alternative hasn’t came out in the next year when I rewire all my light switches, think I will just buy a load of esp8266 dies and pair them up with the MAX485. I will just run a simple firmware to control backlight color and brightness and the interrupts for the touch switch, may even use esp32 if they are cheap enough in bulk by then.

Currently I wire the MAX485 over cat6 with; 2 twisted pairs ground, 1 ground and A pair, 1 ground and B pair, 2 5.1V VCC pairs to allow a little voltage drop, the low amps on the single A & B lines seem to be fine for 20-30m, and paired with a ground seems to stop most interference.

I think when is all said and done ill get a PCB made with most of the components all on it, probably even the touchpad similar to sonoff and mount it behind some white glass for the switches. Not sure about the ceiling hubs as they will be transmitting a fair bit of data and serial might not cut it.

That REPL sharing thing drove me nuts on a controller where I had a PZEM-04 energy meter module on the serial port of an ESP8266. Can’t quite remember the detail to fix it but it had something to do with disabling serial REPL and leaving WebREPL running on boot.

I found this old code… Maybe it did the trick. I’ll check when I revisit that project soon.

print("Booting")
blink_led()
do_connect()
print("Starting WebREPL")
import webrepl
webrepl.start()
gc.collect()
blink_led()

print("Detaching REPL from UART0...")
uos.dupterm(None,1)

print("Ready.")

Here is a pic of my prototype that uses ATMEGA48/88 and a bit-banged “RS485” port on the two comparator pins. A/B or Rx+/Rx- I don’t know if that works yet. The idea is to modify SoftSerial to handle differential signals on A/B (inspired by V-USB) - or a hardware hack that is still top secret (because I don’t even have the details of how it will work myself!) Of course one could just place the MAX485 chip in this path and be done with it.

For “PoE” I use an el-cheapo DC-to-DC module. It’s only good for 24V (and not PoE 48V) but I run my system on 12V so it should be ok.

I also use CAT6 cable but wire it on a terminal block according to the TS568B standard (with PoE). The cable is “spliced” so each terminal gets 2 wires for the “multi-drop” bus arrangement. This turned out to be a real pain with those small terminal connectors. I will most likely put two RJ45 sockets on a PCB and use a seperate RJ45 connector on each cable identical to an Ethernet cable. It’s obviously not Ethernet but plugging the module into a LAN switch shouldn’t do any harm because the two are electrically compatible in this arrangement.

This highlights another benefit of RS485 over Ethernet… Multi-drop. I have 1 cable in my wall that loops past 10 light switches on a bus and returns home. With Eth I would need 10 point-to-point cables to a central cabinet.This really affects the cost of cabling the house. One loop around the house is roughly 50m, visiting the switch points. With point-to-cabinet cabling it would be substantially more. The “patch panel” is also just 1 point as opposed to 10 terminations. Don’t get me wrong… I would love to have a Superhouse style cabinet and cabling but for my small Clever Cottage I had to go with something cheaper and more compact. I actually have over 30 “points” cabled on the bus, ready for the future, and that would be unaffordable if done in a star topology.

The relay is currently on the same board but after reading some of the scary comments on the compliance aspects I will likely move the relay to its own “certified” board connected to Mains voltage and toggle it over a pin from the “low voltage” side. This way an electrician can install the relays and I can do the control stuff without breaking any building codes. It also makes it easier to swap out controllers without having to disconnect the mains wiring.

Here’s a first stab at such an arrangement… Notice the 3-wire “peripheral interface” I was going on about in the Programming Header thread :smile:

My list of requirements for Holy Grail MCU is growing…

  • Low cost
  • Multi-drop bus
  • Stripboardable
  • Electrical Code Compliant + DIY Safe
  • Run MicroPython (moving to ESP in the process)
  • OTW firmware update - pretty difficult on Multi-drop unfortunately
  • OTA firmware update - easy if the wire can tell the ESP to go on the air for an update.
  • Redundancy. Having both Wire and Wifi in the same module could at least partially solve this.
  • Handle full Passive 48V PoE
  • Handle full Active PoE (nice to have)

Not so sure the Low cost one is going to survive for long but let’s try.

Rudie

3 Likes

Nice work @Rudshep, I like your board setup. Yeah multi-drop is a very handy feature, I really didn’t think of doing a chain and its a great Idea for my user where I am going to base out of a central location like superhouse and separate runs out for AD vs DC, I can just run a loop for the light switches.