Single button remote control for TASMOTA

This is just a quick reiteration of a simple project from 2016 to show how easy it is to use an ESP8266 to solve a real-world problem.

Our television is quite a few years old now and still working well, apart from one annoying problem; it no longer recognizes the on/off command from any of the 3 compatible remote controls that we have.  To get around this problem, I popped an ESP8266 into a junction box between the TV and the mains socket, loaded it up with TASMOTA (of course) and then used IFTTT.com to connect our Googly Home Mini back to the ESP.  Now we can just say “Hey Gew Gull, T.V. on!” and everything works like a charm …well, mostly.  My better half mumbles quite a lot (it’s usually “Rhubarb, rhubarb …humbug …seat down”, or something along those lines), but both Goojle and I agree that she does mumble …and it doesn’t seem to matter whether it’s in English or Japanese.  This is a problem, because while I’m always willing to walk across the room to turn a television off, I’m somewhat reluctant to turn the da$”!@ thing back on (and if you have ever been subject to the brain-rotting onslaught of puerile slop served up on Japanese TV, you’ll know what I mean).  The whole point of the ESP was to fix it for her.

However, reading about all the latest and greatest microcontroller stuff over on CNX Software the other morning (over breakfast, while she was partaking of the aforementioned BRooPS),  I came across an article on a low-power LoRa-based dual switch unit, which reminded me strongly of the old 2016 ESP doorbell project. MOSFET power-latch schematic I suddenly realized that I not only had the answer to mumbling (no, not a gag  …don’t be cruel!), but I also had the hardware already built and sitting (somewhere fairly well down) in the “previous-projects” box.

With a television, radio and most lights, you already know the status of that device (whether it is on or off) and the issue is that you want to change that status (think of those light switches at the top and bottom of a flight of stairs …you don’t really notice whether the switch is currently up or down …you just know that in the middle of the night you need to flick the switch at the top to see your way down and then flick the one at the bottom to turn the light off again).  You just want to toggle the state.  One thing that we do know about TASMOTA is that it does “toggle” really well.  So basically, all we need to do is tweak the doorbell demo just a tiny bit to send the MQTT data to a different topic and with a payload of “TOGGLE”.  That shouldn’t be too difficult.

And it wasn’t.  I still had a ton of superfluous crud in the demo code to flash and fade the multitudinous LEDs on the Yellow Dev Board from the previous project, but I just left it in there (along with the OTA update functionality).  The main changes were to add the new topic:-

TV-Switch/cmnd/Power

and add a static payload:-

TOGGLE

Oh, and because I wanted the ESP to stay connected long enough to grab any OTA updates that I might be trying to fling at it, I extended the run time to a whopping 12 seconds and added a boolean flag to prevent the main loop from toggling the power to the TV 11,500 times while we were waiting for the OTA timeout.

The tl;dr summary of the doorbell hardware is that a single tact switch provides a pulse of power to the ESP8266, which is enough to bring it up to the state where it can turn on a MOSFET attached to GPIO16, which is connected directly across the tact switch and so latches the power to the ESP on, even when you remove your finger from the switch.  Once the ESP has connected to local WiFi, sent off its packet to the MQTT broker and handled any pending OTA update (or, most likely, timed out) it simply removes drive from the MOSFET gate, turning it off and thus powering itself down.  There is no “standby” current draw, as the whole unit is powered down.

One-button-remote in operation

All done and dusted in time for her birthday, neybothaman!

 

 

Advertisements

The Odd Bargain

Long term readers will know that I occasionally wander off subject (the ESP8266 and related hardware and software) by quite a way, but usually within the bounds of the  more general subject of “technology”.  One of the consistently popular pages on the site over the past couple of years has been the story of the tiny Z8350 fanless system which I bought a while ago to replace a power-hungry infrastructure server on my home network.  Despite a very rocky start, that little machine turned out to be one of my better buys in recent years and has encouraged me to try some of the other, low-cost systems appearing on the market (mostly with a lot less success than the original Z83).

Anyway, in the course of these experiments, I’ve been finding new outlets and even better deals on more of these “mini PCs” (as they have come to be called) and have been updating the original Z83 page with these odd bargains, as I find them.  For instance:-


Update May 6th 2019 —  !!EUROPE ONLY!! —  A very similar box (Z8350 but with 4GB/64GB and VGA/HDMI video connectors) is now selling for €69.99 (~$78) at Cdiscount (France).   If you’re not in Europe and don’t have a plug-adapter to hand, you can still get an updated 64GB eMMC version with dual video outputs (one VGA, one HDMI) for $99.99 (plus shipping).


(The first one has recently dropped to €65.99, or about $74 US).


Update July 13th 2019  —  !!EUROPE ONLY!!  —  …and the cheapest yet, 4GB/64GB with HDMI and VGA for just €47.95 (about $54) from CDiscount.  Read the small print carefully!


Update Aug 6th 2019 —  As Z8350 afficionados will know, the “Z85” version of this popular little box is generally regarded as the “big brother” of the version described in the body of this article, as it comes with an added VGA port and (usually) 4GB of RAM and a 64GB eMMC.  Well you can currently get the Z85 from this seller on Aliexpress in the 2GB/32GB configuration (definitely –not– recommended for Windows 10) for just $78.16 including free shipping (or $86.19 for the 4GB/64GB version).


I’ve become fascinated recently by the emergence of even more capable systems in roughly the same price range, which are more substantially built (usually with aluminium cases with integrated heat sinks) and slightly more powerful processors.  They’re still not the sort of machine where you’d run a company database or even use for serious gaming, but they are solid little workhorses which, importantly, just sip power and are eminently suitable for 24/7 operations.

One of the common processors used to power these systems is the Celeron J3160, a stablemate of the Atom Z8350 used in the mini-PC systems referenced above.  Both were  introduced at the same time and have remarkably similar specs, with the J3160 having very slightly better general performance, better memory bus throughput and an improved on-board GPU.  Because these chips are no longer leading-edge, the systems using them are now going for very reasonable, or sometimes even “bargain basement” prices.  Here’s the best bargain I’ve come across this week (so far):-

Picture courtesy of Venoen/AliExpressThe VENOEN store on AliExpress is currently offering a J3160 based, barebones system with dual (Realtek) GbE ports, dual HDMI ports, a single RS232 COM port, one internal mini PCI-E (mSATA) slot, one internal mini half-height PCI-E, one internal DDR3L SIMM slot, two USB-3.0 ports and four USB-2.0 ports — for $96.11.  There’s also a normal SATA connector on the motherboard and (apparently) space in the case for a 2.5″ drive (although in a fanless system, it would make sense to limit that to an SSD).

To select the J3160 model at that price, click on “No RAM, No HD, No WiFi” and “2-LAN, 1-COM, J3160”  (careful, there’s an “N3160” button right next to it).  Shipping is free (for my geographical region, anyway).


Update June 25th 2019 —  !!EUROPE ONLY!! —  Another one of those deals for people in central Europe, available from CDiscount.com.  This is a bare-bones J3160 system from Hystou which comes (as far as I can tell) in a plastic case, with no external heat sink.  It is advertised as fanless and otherwise looks pretty much identical to the system above (although it is rather difficult to confirm, because of the lack of specs on the CDiscount page).  It is currently on sale at €69.99 (about $78.50).



†  —  Disclaimer #1 – I don’t own either of these specific models, but I do have a couple of very similar, fanless J3160 systems (review coming soon).

‡  —  Disclaimer #2 – I have never used this specific AliExpress store, or CDiscount, so there is no implied recommendation for either seller.

£  —  Disclaimer #3 – This blog is not monetized in any way.  I do not receive free products to review nor do I get any recompense for “clicks”.  Any products reviewed here are purchased at my own expense and you will find (honest and sometime unflattering) comments on the performance of the suppliers in the reviews.

Arduino ESP32

Various tech news sites (see CNX-Software’s coverage here) are reporting Arduino’s release of an ESP32 enabled board in the Nano family.  Named the “Arduino Nano 33 IOT”, the module looks a little underwhelming at first glance (especially given its $18~20 price tag), but it may be worth digging a little deeper into the specs if you have some specific applications in mind.Arduino Nano 33 IOT

The board sports a u-blox “Nina” ESP32 (which we covered here at about this time last year as one of the few FCC certified ESP modules), providing WiFi and Bluetooth capabilities for the onboard Arm Cortex-M0+ SAMD21.  The board also has an LSM6DSL six-axis IMU and an ATECC608A cryptographic support chip, which are both directly accessible from the ESP32 via the I2C bus.  The connection between the SAMD21 and the ESP32 module is via the SPI bus.

That additional crypto chip gives the ESP32 (and the Nano) the ability to securely store up to 16 keys, certificates or encrypted data, as well as providing hardware support for:-

  • Asymmetric sign, verify and key agreement.
  • Symmetric SHA-256 & HMAC hashing and AES-128 encrypt/decrypt.
  • PRF/HKDF for TLS 1.2 and 1.3.
  • Secure boot support.
  • Random number generator.
  • A unique, 72-bit serial number.

At least some of these features are apparently already supported via the Arduino WiFiNINA library.

It may be a little early to pull out your credit card, though, as the module isn’t going to be shipping until July.

Son of YAESPK (Yet Another ESP Killer)

Seeed Studio have just announced another module based on the Winner Micro W600 ARM SOC.  This one is slightly more expensive than the previous two offerings, but does seem to be a much more sensible design for hobbyists and, with Seeed touting CE/FCC certification for it, attractive to those looking to produce WiFi enabled commercial products, too.W600 module. Picture courtesy of Seeed Studio.  It looks very similar to the ESP12 series modules, with an on-board, PCB antenna and castellated GPIO connectors on three sides of the board.  The metal RFI shield completely covers all of the components, with only the antenna showing externally.  On the version shown on the Seeed pre-order page, the silk-screen pin numbers are only on the bottom of the module and, given the size of the RFI shield, I wouldn’t expect that to change.

The pin-out also looks very similar to the ESP12, with two UARTs, I2C, H-SPI and I2S interfaces. W600 bottom, courtesy of Seeed Studio. Most of the pins share multiple functions and can also be used as standard GPIO or PWM outputs.  As noted with the previous offerings based on the W600, the processor is a single-core Cortex-M3 with 288KB of RAM and 1MB of on-board flash.  The SOC also features an on-board hardware cryptographic accelerator and an ISO/IEC “Smart-Card” 7816 interface.

In yet another echo of an ESP-based past, there is mention of an AT interface mode for communication between an external microprocessor and the W600.  The documentation available on the Winner Micro site does include a Linux based install guide for the GCC toolchain and an SDK User’s guide, along with several other useful PDF manuals, though.


W600 module pinout, courtesy of Seeed Studio.


The module is scheduled to be available for shipping from Seeed on May 22nd at $3.79 per unit, or $3.59 in quantities larger than 20.

 

The Beelink AP35 – Another budget, Intel-based box

Preface — The machine referred to in this article ships with Windows 10 Home Edition.  I won’t be using that OS, but will be describing some of the hardware and giving a couple of tips on getting BSD/Linux running.  As far as I know, Windows 10 will run just fine, straight out of the box.

tl;dr  —  Despite the sales blurb, the AP35 is NOT fanless.

Update —  Currently selling for €99.99 on www.cdiscount.com (France).

Update July 13th 2019 — What appears to be a bare-bones version of the same J3355-based system for just €79.99 (~$89.60), also from Cdiscount.  Looks too good to be true, but today a 4GB/64GB version is being advertised at only €56.99 (about $64) at CDiscount  You might want to go through the small print with a magnifying-glass before pressing the “Buy Now” button.


Although ESP8266Hints is obviously ESP8266-themed, one of the most popular pages on this blog is the one outlining my experiences with the Z83-II mini-PC, which I bought back at the end of 2016.  That machine, despite its diminutive size and “low-powered” Z8350 (quad-cored) CPU is still providing sterling service as a server on the house backbone network and was definitely a bargain (although I wasn’t too sure about that in the first few days following its arrival).  Based on that positive (in the end) experience, I decided to take the plunge once more and replace another machine which, although it still works, is getting long in the tooth and uses far too much electricity for the work it actually does (it’s also so old that many distributions are dropping support for that class of machine).

This time, the story didn’t start particularly well.  Gearbest not only mishandled my order, but also managed to leave their order database completely open to every unknown nasty and their dog at exactly the same time. [Hint:  If you have a Gearbest account, now would be a good time to change your password, if you haven’t already].

The Beelink AP35 wasn’t the first choice on my shopping list, nor was it the second.Makers label.  I ended up waiting more than a month for this unit to be pushed out of the warehouse door because Gearbest were unable to deliver either of the first two.  However, once it was marked as shipped, it made record time in transit and arrived on my doorstep just five days later.

My first impressions were, “Goodness, that’s small!”.  It is really tiny.  When I go back and look at the pictures in the sales blurb, it’s very obvious that they are composites and not a real photograph of the actual unit itself (look a little closer at the shot with the AP35 in front of two desktop monitors, for instance).AP35, pen and USB key for scale  The dimensions given in the description are accurate and looking at the close-up images of the unit itself you can gauge the overall size by comparing the USB and RJ45 ports to the width of the case (my photo of the unit, to the left, has a pen and a USB key for real-world scale).  You need to ignore all of the spurious size prompts in the composite, sales photos to get a realistic idea of the actual size.

Because the case is made entirely of plastic, it’s also extremely light.

In the “Main Features” section of the sales blurb (just above the specifications), the very first line is:-

“● Excellent heat dissipation performance, through the heat dissipation of the casing, achieving zero noise, giving you a quiet and comfortable environment”

Notice that I just mentioned that the casing is entirely plastic, which isn’t particularly known for its heat transfer characteristics.  Well, I can confirm that the “heat dissipation” and “zero noise” claims are complete and utter bollocks.  This system has a cooling fan strapped to the CPU heatsink.  It seems to run all of the time, but the speed is normally fairly low, increasing with higher CPU loads.  By the standards of something like a gaming PC, it is fairly quiet …but it is certainly not silent (even now, when it’s brand new).

CPU heatsink, showing fan

This may not be a big deal for many people, but I have to admit that I wouldn’t have bought this unit if I’d have known that it used a fan.

As you can see from the photo [click on it to see the full-size version], the heatsink and fan actually sit in the top of the case and blow the hot air out through the slots above the HDMI and RJ45 ports.  It’s not such a bad design, but I was surprised to find it in such a small case.

To counter the unpleasant surprise of the fan, when I first powered the unit on, I had two pleasant surprises.  First, there was a prompt across the bottom of the power-on splash screen with the instructions “DEL for set-up, F7 for boot menu”.  Yay!  That’s an improvement over the Z83-II, anyway.  Secondly, the BIOS is much, much more versatile than the Z83-II and, if anything, has too many settings and sub-menus (it was a relief to find that, for instance, it was possible on this machine to set-up for auto power-on after a power fail).  Both of these improvements meant that I didn’t get stuck in the “I’m going to run Windows, no matter what!” loop that the Z83-II suffered from and was able to boot Linux, OpenBSD and FreeBSD with no problem (although installing was a different matter).

Immediately after the warm and fuzzies from the BIOS though, the pendulum swung back in the other direction.  I found that the internal 64GB eMMC wasn’t recognized by most non-Windows OSes.  I fooled around with this for much too long.  FreeBSD-12 was the best candidate I could find to access it, but having successfully installed onto the eMMC, I found that reboots weren’t reliable; more often than not, the system just completely lost track of the eMMC (with timeout errors) and dropped into the “mountroot” prompt.  I’ve tried various “quirk” settings, but all without any lasting success.


mmc0: CMD13 failed, RESULT: 2
mmc0: Card at relative address 2 failed to set HS200 timing
mmc0: CMD7 failed, RESULT: 1
mmc0: Card at relative address 2 failed to select
mmcsd0: Error reading EXT_CSD Timeout
device_attach: mmcsd0 attach returned 6

I got sick of mucking around with that fairly quickly and decided to take advantage of the available 2.5″ SSD/HDD mounting point in the base of the unit.  [WARNING — Only a 7mm height drive will fit].  I slapped in a Crucial BX500 120GB SSD (the SATA cable is already attached to the mother board of the AP35, with the flying end taped down to the bottom panel of the case, so be gentle when opening it).  The BIOS (and FreeBSD) saw the new drive immediately and the install was completed in just a few minutes (no reboot problems so far and none really expected with a standard SATA drive).

The SSD fits very snugly into the bottom of the unit, although there’s very little clearance between the disk and the components on the motherboard.  The fan is actually on the other side of the motherboard, so I’d be wary of installing spinning rust in this cramped location due to possible heat problems.

As a plus for the adventurous, there are two slots available  (in the area which my SSD Detail of motherboard showing mSATA slotsnow occupies) which look like mSATA to me.  I don’t have anything to hand which would fit those, so I can’t comment on how well (or even if) they work and the support posts, along with the silkscreen outlines on the motherboard, left me wondering whether perhaps only one slot could be used at a time.  If you have experience using this type of “stepped” mSATA connector, please do leave a comment as to how well they perform and how those two support pillars are meant to work.   …and reader Carey Bishop sorted that out for me (and everyone else) when he noticed this additional information on Banggood’s sales page for the AP35:-

Additional information courtesy of Banggood.com
Additional information courtesy of Banggood.com

Carey also included a couple of links to boards which would fit in those slots (see the comments section at the bottom of the page).  The mini-PCIe only accommodates half height cards, which explains the support-post placing.  Thanks for that, Carey!

Anyway, once FreeBSD was installed on the SSD, it had absolutely no problem finding and using the 802.11ac WiFi and connecting to our 5GHz router, so another Intel AC3165 WiFi/Bluetoothplus point there.  The on-board WiFi/Bluetooth module is an Intel AC3165.  So far I haven’t got around to testing the Bluetooth functionality, but the fact that the WiFi works so well is a good omen.  Note that the two (internal) antenna cables are seriously gunked onto the module, which makes moving the motherboard around a little difficult.

The large connector to the right of the AC3165 in the photo is the motherboard end of the SATA lead for the internal SSD.

So far, so good.  The machine has been running flawlessly (but not silently …did I already mention that?) for the last week or so and I’m quite happy with its performance.  I’ll no doubt be updating this article with newer information as I attempt to transition it to the intended application on our home backbone, but here’s the short summary, so far:-

Pros:-

  • Compact enough to fit into a very small space.
  • Lightweight, so easily portable.
  • Comes with two HDMI cables, one short and one longer, as well as a wall/monitor mounting kit and screws.
  • Comes with two, unpopulated internal slots; one 50x30mm mSATA and one half-height 30x27mm mini-PCIe.
  • Comes with a SATA cable and mounting (with screws) for an internal 2.5″ HDD or SDD.
  • Normal (rather than cut-down) BIOS available.
  • Boot/BIOS prompts automatically displayed at power-on.
  • Dual-band (Intel 3165) WiFi with internal antennas.
  • Four USB-3.0 ports.
  • Cheap (currently selling for $140 with free shipping).

Cons:-

  • Not fanless and not silent.
  • The internal eMMC doesn’t appear to be very well supported by operating systems other than Windows-10 at this point in time.

 

Bottom Lines

As you can see, there really aren’t that many cons.  All in all, I think this is very good value for the price.  The quality of the build is also good, considering the price point.

There are several use cases that spring to mind for something this cheap and so compact.  One example would be a low-cost diskless node; the GbE interface should provide plenty of throughput and the BIOS does seem to allow PXE boot.  Another use would be as a low-cost desktop — if you happen to already have a decent monitor,keyboard and mouse set left over from an older machine, this system would be an excellent way to get a younger member of the family going with newer hardware on a slim budget.

Would I buy another one?  Probably not, but that’s because of the specific issue of the system not being fanless.  If the idea of it having a fan doesn’t bother you, then I’d certainly recommend this little system as being excellent value for money.


Additional OS Info —  NomadBSD 1.2, a FreeBSD-12 based distribution intended for use from a USB key, was released a few days ago and, because the OS doesn’t attempt to install itself on your machine (it runs from and stores config info to the USB key), it’s actually a pretty good candidate for testing out the real-world, desktop performance of your new machine.  Be sure to select “console frame buffer” and not “auto” from the set-up wizard though (auto seems to screw up frame buffering, but the console setting works fine, even with videos).

“dmesg” Info — Linux (Ubuntu), FreeBSD-11 and FreeBSD-12 (NomadBSD) dmesg files are available here, for anyone who’s interested.


† —   Anglo-Saxon/Middle-English (slang) – Used frequently to mean “nonsense“.


 

ESP32 + W5500 — Simple Working Example

Update June 2019  —  A couple of people have mentioned (both here and on GitHub) that they are having difficulty compiling the code for this project, with “invalid abstract return type” errors.  This turns out to be an upstream problem caused by a non-backward compatible modification of the Espressif  arduino/ESP32 library.   You can force the build to use an older (compatible) version of the library by changing a single line in your platformio.ini file:-

—  platform = espressif32
++  platform = espressif32@1.6.0

Thanks to @maniekQ for documenting this workaround.


Over the past couple of days, in the course of answering questions on the popular article on adding an ethernet port to the ESP8266, I found myself putting up a link to some new code for a work-in-progress project which simply replaces the ESP8266 with an ESP32 (which seems to make a lot of sense, given the falling cost of the ESP32 modules, nowadays).  ESP32 + W5500 moduleWhile that project is for an ESP-Now gateway, it seemed like there was a need for a nice, simple test and verify project where people can do a minimum of work with the hardware (an ESP32, a W5500 module, some jumper leads and a breadboard) and get a working result in a reasonably short time.  I’d said in various places that it shouldn’t take too much work to modify the code for the ESP-Now project to handle any of the examples shipped by default with the Arduino Ethernet library, so that’s what I’ve done.

Here’s the code (along with the pinouts in the README) for the simple “UdpNtpClient” example, munged very slightly to work with the ESP32Output exampleAll it does is connect to an NTP server, retrieve the current timestamp and display the UTC time.  This is basically a 30-minute project to produce a working demostration of an ESP32 using hard-wired Ethernet.

The configuration uses a static IP and network setup (router/gateway, netmask and DNS), as the original ESP8266 project seemed to have problems with DHCP (and quite honestly, I just haven’t gotten around to trying it with the ESP32 version, yet …let me know how it goes if you do).  All of the configuration options are in the “local_config.h” file.

The original library example code uses a single NTP server, “time.nist.gov”, which seemed a little anti-social to me, so I’ve added several of the more popular geographical pools into the config file and updated the default target to be the main “pool.ntp.org”.   You should choose the one closest to you (unless you’d like to see how unreliable bare UDP really is, in which case you might like to try “antarctica.pool.ntp.org”  —  apologies if you’re reading this from McMurdo Station 🙂 ).

 

 

‘nuther New Kid almost on the Block

If you’ve been following techie news this week, you’ll probably have already seen the photos featuring the grungy soldering around the new “Chip-7” (and if you haven’t, here’s CNXSoft’s coverage).  Hackaday also covered the new chip, as part of Mike Szczys’ series on his trip to China.  Mike also produced an excellent interview with Ivan Grotkothov (probably better known to folks here as “igrr”) at Espressif, for Hackaday podcast (#11 — the interview with Ivan starts at the 44-minute mark).  The interview included just a couple of tidbits of extra information on the chip:-

  • It has more pins than the existing ESP32 and they will be predominantly GPIOs.
  • The power requirements and the overall performance won’t be too much different from the existing chips, but…
  • …it will be good value and a worthwhile improvement.
  • It will support Flash and PSRAM‡ on the carrier module.
  • The photo shows an engineering sample, so no firm date for release (or pricing), yet.

In addition, Jeroen “Sprite_tm” Domburg dropped in to leave a comment on the Hackaday page that the current, full title of the chip is actually “Chip 7.2.2”, but since that’s only an engineering label, we can expect it to change before the actual release, anyway.


‡ – Pseudo-Static RAM  – A dynamic RAM chip with on-board refresh circuitry which appears as static RAM to the processor.