Management microcontroller for HC1

Share here your ideas for new projects

Moderators: meveric, mdrjr, odroid

Management microcontroller for HC1

Unread postby Nominal Animal » Sun Sep 17, 2017 10:06 pm

I intend to use an Odroid-HC1 as a small home automation/cache/firewall server, with an USB 2.0 3G/4G/LTE modem. As I understand, the HC1 does not have any exposed GPIO pins, only a 1.8V serial port. Note that I'd rather avoid a (powered) USB hub, so USB-IO is not something I want to use here.

Here's my plan thus far:
  • 3.3V 8 MHz Arduino Pro Mini as the microcontroller; one of the models that has a 150 mA 3.3V voltage regulator that can handle 5VDC input
  • SparkFun/Adafruit voltage level shifter (1.8V-3.3V)
  • 5V input (4A or 6A) split to the HC1 power jack, and to the microcontroller
  • A small OLED (128x32 or 128x64) for status display
  • Some buttons, rotary encoders, DS18B20/DS18S20 temperature sensors
  • Possibly a proximity sensor and chassis sensor for tamper detection
  • Possibly a latching/bistable relay to control the HC1 power as an option
I've ordered the parts from above (mainly the microcontrollers; I currently only have Teensies and some Atmega32u4-based Pro Micro clones), and living in an obscure corner of Europe, will have to wait three or four weeks for the parts to arrive (or spend 3x-4x more to get them from local retailers). As usual, this is a near-zero-budget project for me.

The basic idea is that whenever 5 VDC is available, the microcontroller is powered, regardless of whether the HC1 is powered or not.

The low side of the voltage shifter is connected to the 1.8V serial port on the HC1. (Note: the unidirectional voltage divider in these is usually set to 2:3, so that high-side 5V is 3.3V at the low side; at 3.3V high side, this means 2.2V on the low side; too high. I will use the bidirectional lines only (even though the signals are unidirectional), so that the low side signals will be at most 1.8V (from the serial port VDD_IO pin) regardless of the high side voltage.)

I will have to disable the serial console, but that isn't an issue for me. If I need to, I can keep the uboot serial console enabled, and have the microcontroller handle the early boot; with the userspace daemon using a dedicated message to switch the microcontroller to command-and-response mode from boot mode. (There are escape sequences and byte sequences that should never occur in the serial console output.)

At least one button will be for a controlled shutdown (and/or power-on/power-off, if I use a relay to control the power to the HC1). Other buttons, or a rotary encoder, will vary the subsystem status shown on the mini-OLED display. I might map other buttons to keypresses (this is easy in Linux in the userspace daemon, using the uinput device).

If I implement the relays, I may use a LiPo battery or supercaps to keep the microcontroller running during short power outages. The idea being, the power should be stable for a while before starting the HC1.

I think I'll be using Devuan for this one. I know why end-users like systemd, but for servers and appliances, systemd is a horrible, horrible design error wrapped in bad planning and implementation. The systemd developers diss both the Unix philosophy and the KISS principle, even though their results already show they're heading into an eventual everything-must-be-in-systemd deadlock/complexity explosion, with the number of open bugs likely eventually forcing users switch to something better, or off Linux altogether. Besides, the main developers irk me, so I'd rather just spend my time tinkering with something else.

(Yes, yes: I do love to overengineer my stuff. It's more fun for me that way.)

It would have been exceptionally nice to get TPS259251 VIN (power jack +5VDC), P5V0 (+5VDC), VDD_IO (+1.8VDC), GND, and either another UART or a SPI bus exposed on pads on the HC1. That way I could have added the "management microcontroller" easier, without conflicts with the existing serial console -- maybe even write a kernel driver for this.
Nominal Animal
 
Posts: 31
Joined: Sat Sep 16, 2017 12:51 pm
Location: Finland
languages_spoken: English, Finnish
ODROIDs: C1+, HC1

Re: Management microcontroller for HC1

Unread postby phaseshifter » Mon Sep 18, 2017 12:43 am

if you use a hardware relay for powering the board down without the use of a gpio then you risk corrupting the file system..."poweroff" from the command line is the best and only way i know of for shutting it down safely
4.9.xx.xx odroids
phaseshifter
 
Posts: 2529
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: opp sys.. ubuntu .kernel 4.9.xx.xx.c1+ ..c-2..xu3 lite,xu4...vu7,vu8,c-shell -II..c-shel-II,uart,hi-fi ,,hi-fi2,,show,w-board,6x16GB emmc`s 3.5 inch touch...other odroid acc`s as well

Re: Management microcontroller for HC1

Unread postby Nominal Animal » Mon Sep 18, 2017 1:42 am

phaseshifter wrote:if you use a hardware relay for powering the board down without the use of a gpio then you risk corrupting the file system...

That would just defeat the entire idea of a management microcontroller, wouldn't it?

No, my idea is to always do a controlled shutdown via the userspace daemon, and then turn off the relay. I'm not excluding writing a kernel driver, though. I'm actually right now downloading the linux-odroidxu4-4.9.y kernel tree to see the native serial driver code.

Does the HC1 actually turn off, or just halt? (I have to wait until Thursday to get mine to find out myself.)
Nominal Animal
 
Posts: 31
Joined: Sat Sep 16, 2017 12:51 pm
Location: Finland
languages_spoken: English, Finnish
ODROIDs: C1+, HC1

Re: Management microcontroller for HC1

Unread postby phaseshifter » Mon Sep 18, 2017 1:49 am

Code: Select all
poweroff


this command will shut it down but for total power off state hence no red led lit is "cold" state..it must get issued the command or the machine code for this command then you can set your relay to turn it totally power off "cold state" if you will..
4.9.xx.xx odroids
phaseshifter
 
Posts: 2529
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: opp sys.. ubuntu .kernel 4.9.xx.xx.c1+ ..c-2..xu3 lite,xu4...vu7,vu8,c-shell -II..c-shel-II,uart,hi-fi ,,hi-fi2,,show,w-board,6x16GB emmc`s 3.5 inch touch...other odroid acc`s as well

Re: Management microcontroller for HC1

Unread postby phaseshifter » Mon Sep 18, 2017 1:51 am

power off is power off the red led will remain lit so the hc1 will shut down but "power good" red led remains..the drive will shutdown as the processor etc..etc..
4.9.xx.xx odroids
phaseshifter
 
Posts: 2529
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: opp sys.. ubuntu .kernel 4.9.xx.xx.c1+ ..c-2..xu3 lite,xu4...vu7,vu8,c-shell -II..c-shel-II,uart,hi-fi ,,hi-fi2,,show,w-board,6x16GB emmc`s 3.5 inch touch...other odroid acc`s as well

Re: Management microcontroller for HC1

Unread postby phaseshifter » Mon Sep 18, 2017 1:58 am

re trigger the relay and it will power up again...!!! to normal running state...!!!
4.9.xx.xx odroids
phaseshifter
 
Posts: 2529
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: opp sys.. ubuntu .kernel 4.9.xx.xx.c1+ ..c-2..xu3 lite,xu4...vu7,vu8,c-shell -II..c-shel-II,uart,hi-fi ,,hi-fi2,,show,w-board,6x16GB emmc`s 3.5 inch touch...other odroid acc`s as well

Re: Management microcontroller for HC1

Unread postby campbell » Mon Sep 18, 2017 2:06 am

Be aware that I fried an Odroid XU4 using one of those Sparkfun level shifters trying to get at the 1.8V logic level of the Exynos chip. I think there is some nondeterminism in the order in which parts of the level shifter circuit power up, and I got unlucky. viewtopic.php?f=97&t=16421
campbell
 
Posts: 223
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Management microcontroller for HC1

Unread postby Nominal Animal » Mon Sep 18, 2017 3:07 am

campbell wrote:Be aware that I fried an Odroid XU4 using one of those Sparkfun level shifters

Ouch. Thanks for the warning!

Was the shifter that particular one (four bidirectional shifters) with HV1, HV2, LV1, LV2 markings; or the older (11978) with TXO,RXO,TXI,RXI markings? The bidirectional ones should use mosfets, and shouldn't "leak" any current or voltage when the low-side Vcc is zero. However, in the older ones, RXO-RXI is just a voltage divider, and is likely to break the HC1, since simply powering the high-side and pulling RXO up means RXI will have 2/3 of high-side Vcc, even if low-side Vcc is at 0.

I think I'll be very careful, and use something like the Adafruit TXB0104 level shifter, which can handle even 1.8V to 5V shift. The chip used on it has a Vcc isolation feature, which puts all outputs to high-impedance state it either Vcc is low.
Nominal Animal
 
Posts: 31
Joined: Sat Sep 16, 2017 12:51 pm
Location: Finland
languages_spoken: English, Finnish
ODROIDs: C1+, HC1

Re: Management microcontroller for HC1

Unread postby campbell » Mon Sep 18, 2017 5:43 am

It was the newer one in combination with the 449 part mounting an rs232 port, which can be used by itself down to 2.8 volts but requires assistance to go lower (confirmed this on my bench). I never actually solved the problem, but I don't use XU4s anymore...hopefully if 1.8V becomes more common, the requisite level shifting and buffering would be built into any board that uses it.
campbell
 
Posts: 223
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power


Return to The Ideas

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron