Reworking the AI-Thinker T5 – Part VII

For the last in our current series of updates, we’re going to modify the board to make switch K2 into a mode control button.  Pressing the button during power-on will initiate a simple light show (it’s going to be very simple …there are only three LEDs).

Switch K2 is the one closest to the LEDs and we’re going to wire it up to GPIO4 on the ESP module.  If you recall our previous instalment describing the rework for switch K1, you’ll remember that  we already added the 22K pull-up resistor for K2 at the same time, so this final bit of rework is simply adding one wire.Switch K2 Wiring  The photograph shows the routing for that wire, down the side of the original jumper block and then skirting K2 itself to connect to the pin on K2 which is closest to the corner of the PCB (the bare wire on the other side is the leg of the pull-up resistor).  With the previous experience of adding the LED and K1 wires, this last one should be a breeze.  The GPIO pin is on the side of the ESP module which is closest to the switch and soldering to the pins (at both the ESP and K2) is easier than trying to tack down to the QFP pads (without bridging them).  If you route the wire close to the jumper block you’ll only need a couple of right-angle turns and you’ll leave the area around the LEDs clear of any visual obstruction.  As with the previous mods, hold the wire down to the PCB with super-glue or melted hot-glue at several points along the run.

That was easy!

The updated code for the K2 “mode” switch is already available in the GitHub repository.  The code changes the power-on behaviour to add a 3-second delay (with a prompt squirted to the serial port) to allow the user to press switch K2 to go into “blinkenlights” mode.  The ESP will run a brief display on the LEDs and then automatically drop back into normal operating mode.  The other changes are:-

  • The power-on “I’m alive!” indicator has been changed to two, brief flashes of the green LED.
  • The sensor-read indicator has been changed to a single, brief flash of the red LED (Note:- the red LED may flash more than once if the ESP sees bad data coming from the DHT11 and issues a re-try).

As I mentioned at the start of this post, this will be the last of this series of updates.  We do have one free GPIO pin left and we do still have the beeper and its driver circuitry intact (a small miracle, given its history).  However, I have to admit to having no great longing to connect the two together at this moment in time.  Depending upon how the board performs over time in its primary role as a battery-operated sensor, I might decide to add the beeper functionality back in (but basically, if it continues to work without devouring too many batteries on a monthly basis, it will probably stay in-situ, as it is).

I also mentioned in a previous post that I would be using the pads freed-up by the removal of the relay and screw-down connector to add a diode (to allow the board to draw power from the 5v USB adapter), but as the batteries are holding up quite well so far (and because of the possibility of someone — me! — accidentally leaving the batteries in while the USB is connected), I’m postponing that to some, unspecified later date (a hairline this side of never), too.

Let me know how you get on with your own versions of these hardware and software mods and, if I remember, I’ll try to leave an update here every now and then to let you know how the modded T5 is holding up long term.

Update – Well, after a couple of months running this as a battery-powered sensor node I’d like to add a couple of observations.  First, the battery life isn’t great.  I’m using deep sleep of course, but I had trouble getting the wireless to reliably reconnect to the preconfigured access-point if I disabled wireless at start-up and only initialized it when I wanted to talk to the MQTT server (which would conserve more power).  Second, the DHT11 sensor is fairly crap (as many have noted before), with occasional readings being way, way off from the previous or following measurements.  I’ve recently had much better luck using a BME280 sensor unit, which also includes barometric pressure (as well as using the standard, Dallas one-wire sensors for just plain, vanilla temperature measurement).  On a slightly more positive note though, the ESP8266 sensor nodes do seem to be very reliable (given a good set of batteries) and the MQTT broadcast timestamp and generation of sensor data works very well.

 

 

Advertisements

This one’s quite neat!

One of my long-standing favourite shops in Tokyo’s famous Akihabara district, Akizuki Denshi, has just started selling the WROOM-02 (that’s Espressif’s own version of the ESP-13, just in case you haven’t been paying attention) with an adapter PCB kit which brings out the pins to a breadboard-friendly connection.  It’s quite novel.

Akizuki Denshi WROOM-02 to 2.54mm DIL adapter board
Akizuki Denshi WROOM-02 to 2.54mm DIL adapter board

The kit comes with the WROOM-02 already soldered onto the board, but the header pins (although included in the package) need to be soldered to the PCB by the purchaser.  The kit (including the WROOM-02) is priced at a very reasonable 680-Yen (that’s about $5.70) plus shipping.  Unfortunately, they don’t ship internationally.

They are also selling the bare PCB as a separate item for just 120-Yen ($1.00).

As you can see from the photo of the bare PCB, all of the pins are broken out to the adapter (including the three, separate grounds).  As far as I can tell from the photos and from the text, there are no pull-ups or pull-downs; just the pin connections and nothing else.

Bare PCB
Bare PCB

Akizuki have a long history of producing kits and PCBs for the hobby market in Japan and a look at the “kit wall” in their shop is a good, barometric indicator of what’s hot in the embedded community here (of course the challenge is actually managing to elbow your way in there to be able to see it).

‘nuther new something in town …you can safely ignore it!

AI Thinker have obviously been listening …but the question is, to whom.  They’ve just come up with something which they’re calling the “ESP8266 Black board T5” (their capitalization, not mine).  It looks really interesting at first glance.

ESP13/WROOM-02 AI Thinker board, with battery box
AI Thinker “Black board T5” development board with attached battery box

[Update:-  I ended up reworking this board to make it somewhat functional.  If you’re comfortable with a soldering iron, you might be interested in these notes]

There’s a relay and a couple of screw-down connectors at one side of the board and what’s obviously one of the older  (blue) DHT11 temperature/humidity sensors on another side, sitting next to an ESP13/WROOM-02 module.  Between the relay and the DHT11 is a barrel-connector for DC input, but the unit also comes with a 3-cell (AA size) battery box attached via short flying leads (the board itself is just a little bigger than the battery box).  There’s a beeper on the board and there are three LEDs arranged in a vaguely spoke (as in bicycle wheel) shape.  In addition, there are two mini “tact” switches, a couple of jumpers, a slide-type on/off switch and, sitting like a spider in the middle of its web, a mysterious, 32-pin, QFP package chip.  Etched along the edge of the board is “ESP822_IOT_DEMO” (sic) and also “AI-CLOUD INSIDE”.

As usual with the on-line auction site vendors, there’s b’grall useful information on any of the pages which I could find (and as the auction sites advertise it as an “ESP8266 Serial Development Board” it’s also next to impossible to find any useful information on the web, either).  Anyway, just looking at the board I thought it had to be worth the $10 asking price, just in parts alone.  With a bit of luck, the mystery chip might turn out to be an I2C expander or something equally useful.  Throwing caution to the winds (poor old Caution!), I added a single unit (Caution must have crawled back home again while I was surfing dBay) to the next order I made for other odds n’ends.

Tum-de-dum-de-do.  Wait for a couple of weeks.  Odds n’ends arrive, along with da’ board.

AI Thinker
AI Thinker “ESP8266 Black board T5”, with red LED visible just to the left of centre.

Hmmm…  Don’t recognize the number on the top of the mystery chip.  Never mind, throw in some batteries and slide the switch to “On”.  A red LED (which I hadn’t noticed in the pictures) lights up and, after a slight delay, the board starts to emit an annoying “Do something within the next few seconds, or I’ll explode” kinda’ beep.  I press one of the buttons.  It still beeps.  I press the other button.  It still beeps.  I switch it off, hold down one of the buttons and switch it back on.  It starts to beep again.  Same procedure, but other button.  Ahah!  a single beep and then blessed silence …for about a second, then it starts to beep again.  I rip the batteries out and throw the whole thing in a drawer (I was sorely tempted to throw it on the floor and stamp on it, but I thought I might damage the floor).

Back to the web (as there was b’grall documentation in the package, of course) and I resort to a Oogleg image search.  Oogleg’s image processing may be wonderful, but it seems to think that this PCB is a dead-ringer for all sorts of weird and wonderful stuff on the web that just happens to have a black PCB.  I finally find a link to AI Thinker’s forum and a thread which has some links to documents (Yay!), one of which seems to be an English PDF (double Yay!).

My yaying turns out to be a little premature.  The English documentation is limited to the schematic and it’s a fairly useless one, at that.  Many of the components evident on the board aren’t present on the schematic at all, labelling is haphazard, parts are wrongly identified (the 32-pin QFP is labelled as an STC15L2K16S on the schematic, but the part on the board is an STC15L2K32S2 [see below], the sensor is identified as a DH11, but the part on the board is definitely a DHT11) and plugs, sockets and jumper blocks are all depicted as unidentified rectangles.  One thing that does stand out immediately though, is that most of the GPIO pins on the ESP8266 are unconnected.  Uh-oh!

T5 Schematic
Original Schematic

A P-Channel MOSFET (top R/H corner of the schematic) gives another clue to what’s going on here.  The drive signal is labelled “WIFI_VCC”.  It’s a supply-side switch for the ESP8266 power.  The board is battery powered and it looks as though the ESP8266 is only powered up when a network connection is needed (and I recognized this simply because I’m doing the same thing with one of my ESP8266 projects, but using a DS3231 RTC module to drive the power switch).

So, it turns out that AI Thinker have produced a board which has a “master” microcontroller and is using the ESP8266 simply as a network interface.

Next to the on/off slide switch there’s a three-pin connector (barely visible in the photo above – it’s slightly above and to the left of the DHT11) with the silkscreen label “R-G-T”, which appears to be the serial port for the microcontroller (not for the ESP8266).  I pulled the unit out of the drawer again just long enough to connect up the pins and go through the press-beep-disconnect routine a few more times at various baud rates.  I didn’t ever get any indication of any output at all in the terminal window.  Zilch!  Nada!  Nutt’n!  At the same time I fired up a WiFi scan on one of my access points.  I could quite easily see my neighbours’ access points going up and down, but no indication at all that the ESP-13 on the board was ever powered-up.  Back in the drawer wi’thu useless burger!

I might possibly drag the thing out again and have a poke around with a multimeter, but not before I’ve de-soldered that bloody annoying beeper.

The microcontroller chip on the AI Thinker
The microcontroller chip on the AI Thinker “Black board T5”

As far as I can tell from the scant information available for this microcontroller part number available on the web, the chip is an 8051 derivative, with 32K of onboard flash memory.  I haven’t used an 8051 chip in twenty years and, although I’m sure there are some folks out there who will be positively salivating at the thought of an 8051 paired with an ESP8266, there will most certainly be many thousands more who will be scratching their heads and saying “WTF?”.  I’m not (and probably never will be) an AVR/Atmel kinda’ guy, but why AI Thinker would AI Think it a good idea to produce a board for the hobby market with such an odd-ball chip is beyond me.  If they’d dropped in an ATtiny85, a Propeller, an MPS430, a PIC18F/24F, or just about any low-end ARM chip they would have had the (ESP8266) world beating that proverbial path to their door.  As it is, they’re destined to get a big, red “FAIL” stamp splattered across their collective foreheads.  Anyway, if you’re at all interested, I finally found the data sheet for the chip on STC’s web site (no thanks to their total lack of indexing or search function and the quiet inclusion in one data-sheet — with a single processor ID as the only title —  of 18 different chips).  The highlights are, yes 8051 based, 32KB of flash, 2KB of SRAM,  29KB(Eh?!?) of EEPROM, 2 x UART, 3 x PWM, internal clock and 8-channel, 10-bit A-to-D.  If all of that lights your fire, then this is the board for you (and I’ll sell it to you …cheap!).

Hold on just a second; I need to go and add a “Double Duh!” category for this one.

Update – In an effort to introduce some semblance of balance into this post (and especially to note that I’m not, generally “anti” AI-Thinker), I’d like to point you at a couple of articles on one of their other boards, which actually is something of a bargain!  Just about the only thing it has in common with the “T5” is a long and overly complicated name, but you should definitely keep an eye open for the ESP12-based “Yellow Development Board”.  Apart from anything else, it has lots of nice flashing LEDs and you don’t need to resolder anything to get them working.

‘nuther new kid… hedzup!

Top view of the new, ESP8266-ESP13 -- Photo courtesy of AI-Thinker
Top view of the new, ESP8266-ESP13 — Photo courtesy of AI-Thinker

The WROOM v2 (aka ESP-13, aka ESP8266MOD) is becoming readily available on most auction sites, although hard details regarding memory/flash sizes are not easily found (rumours abound).

This little beastie uses yet another different form-factor and yet another different pinout.  The pitch of the castellated pins is 1.5mm, meaning it (along with its bretheren) doesn’t fit onto a normal breadboard and it won’t fit onto any pre-existing PCB designed for any of its predecessors, either (including the WROOM-01).

Currently, doing a search on eBay for “ESP8266” and sorting by lowest price, brings up the ESP-13 at the top of the list, with one vendor selling them at $2.89 (with free shipping).  That’s a pretty good deal even if the memory/flash sizes are still the same as the previous models.

Update #1 – Pins – The ESP-13/WROOM-02 modules have 18 pins available, as opposed to the 16 pins on the normal ESP-12 modules (yes, I know the ESP-12E has more).  However, two of the pins on the ESP-13/WROOM-02 are extra ground pins (duh!), so effectively it has the same number of pins as a standard ESP-12, but is more difficult to solder because of the reduced clearance between those pins.   😦

Update #2 – I noticed recently that these modules have started popping up from some of the Amazon vendors.  This seemed like good news, especially as the prices weren’t too much above the eBay/Alibaba ones.  The first vendor I tried had “In Stock” marked on the Amazon page and a very competitive price.  With the normal Amazon turn-around on shipping it seemed like a good deal, so I ordered a couple.  The order was mixed in with some other stuff and I got a normal, automated “We’ve received your order…” email immediately after submitting it.  Unfortunately, the next email, from the ESP13 vendor, said “Shipping via CHINA post”.  Duh!  If it looks too good to be true, it -is- too good to be true.

Well, the next (Amazon) vendor I tried had a web-shop with the same name, based in the country where I live and stating (on their shop page) that the WROOM-02 modules were in stock.  The price was a little higher (although not much) than the first vendor, but I thought I’d give them a try and see whether they shipped the ESP-13 or the WROOM-02.  This time I got the modules (via normal post-office delivery, not Amazon’s normal delivery service) two days later.  The modules were genuine WROOM-02’s.  Yay!  This vendor is here in Japan, so if you use amazon.co.jp I can recommend “Microtechnica” as a vendor (or you can go directly to their web shop at http://www.microtechnica-shop.jp/).  If you’re not in Japan, it’s still worth checking your local variant of the Amazon store to see whether the ESP8266 has started showing up; just try to make sure that any vendors you find have local stock and aren’t just “fronts” for someone shipping (slowly!) from China.

Update #3 – As per the previous update, I now have a couple of different versions of this module to play with.  The first thing that I  noticed is that the ESP-13 and WROOM-02 are not identical.  The WROOM-02 has a much cleaner overall finish.  In particular, the metal RF shielding is much neater, with a brushed aluminium finish, sealed corners and a neatly trimmed and soldered bottom skirt.  The ESP-13 on the other hand, has a fairly ragged RF cover, with the uneven bottom edge of the skirt getting very close to the pins in several places.  If you’re hand-soldering these modules, the WROOM-02 is much easier to deal with.  On the ESP-13 you might want to check with a multi-meter whether there are any shorts between the pins and the RF shield.

Update #4 – Continuing on with the soldering story… Hand soldering these modules (both the ESP-13 and the WROOM-02) onto strip-board using flying leads of thin wire is a pain in the proverbial.  Because there are more (side) pins than on the ESP-12 and because they’re closer together (smaller pitch), you need to use longer flying leads (the thin wires between the strip-board and the module pins) and they need to be angled more acutely (the leads to the centre pins of the module are almost straight, but as you move out towards the ends of the modules, the distance between the strip-board hole and the corresponding module pin becomes greater and greater, requiring a longer lead with a more extreme “S” bend in it).  It’s do-able, but I wouldn’t want to do very many of them.

However, help is at hand.  Eldon R. Brown, over on his blog, has come up with a very neat adapter board design which overcomes the biggest bugbear of most of the other adapters out there, namely that the resulting module+adapter is so wide as to make it impossible to connect to on a normal solderless breadboard, as it covers all of the available holes.  Eldon’s design uses surface-mount header pins to tuck the connections back in underneath the module, giving it the effective footprint of an 18-pin DIP chip.  Nice one, Eldon!

Eldon has made his adapter available as a shared project on OSH-Park, so I’ve ordered up a few (and some of the SMD header pins, too).  I’ll let you know how things turn out with them.

Update #5 – The data-sheet from Espressif for their WROOM-02 states that the external flash memory chip used on that module is 4MB (see comments, below).