The Commadorable 64

Update Aug 28th: The BOM for all variants is now on Github. Please see the notes at the end if you want to build a Commadorable 64 yourself.

The ILI9341 based QVGA displays found on eBay for €4 are well suited for making small screenlets telling the current temperature, weather forecasts, traffic situation to work and spreading them over the house. As PCB design is both fun, cheap and rewarding I did a custom PCB for these tiny displays. Actually, I made three, one for each of the 2.2″, 2.4″ and 2.8″ screens. The 2.8″ version has not been produced but the smaller variant have and work well. From 2.4″ and onwards there is (untested) touch support on the screen modules.

The “Hello World” application for this project also named the PCBs. I call them Commadorable 64. Here is why:

LEGO Stormtrooper added for size reference
LEGO Stormtrooper added for size reference

The cursor blinks but I resisted the urge to create an animated GIF. “Commadorable 64” is a play with “Commodore 64” and “adorable”. It has been scientifically proven that those for whom the Commodore 64 played a significant part of their childhood will look at the 2.2″ version of the C64 start screen and react the same way as cat people looking at kittens. Heads will be tilted slightly sideways, smiles appear and sounds like “naaaaaaaw” will be heard. I have one of these at work and depending on childhood experiences people will either go “what?” or “naaaaaaw”.

ESP side
ESP side

The PCB is soldered directly to the pins of the ILI9341 module. Some of these screens will probably end up in other applications in the future. The other day I read about openframe.io and adding support for these would be fun.

The PCBs can be ordered from DirtyPCBs.com, 2.2″ with a bonus AAduino and 2.4″ version with touch. The BOM consists of the usual components for my ESP8266 designs. We have 0603 resistors and capacitors, a 3x6x2.5mm momentary push button [eBay] for displaying the IP address, a SOT23-3 P-mosfet to control the backlight, an LM1117 voltage regulator and a SOD-123FL schottky diode for reverse power protection and optional mini USB connectors. The PCB can be powered in three different ways depending on personal preference (well, four including the esprog interface). There are footprints for normal [eBay] and vertical [eBay] mini USB connectors, depending on if the module is to stand on a table or hang from a wall (Eagle parts available on Github). In addition there is a 0.1″ header for power. All power paths are protected by the diode.

Further update Aug 28th. I see some 20+ orders on DirtyPCBs for both Commadorable 64 variants which is great fun and I would really love to hear what you will build. I have some recommendations you might find useful. I have received a few broken ESP-12e/f modules on eBay over time and one broken ILI9341 module. Because of that I always try the modules before soldering them using my Esparducam board with the ESP Pinlet add on board. When a module passes testing I flash it with the ESP Open RTOS OTA basic demo meaning I can OTA any device directly after soldering. Also, you will note there is no FTDI connector on these boards, the reason is described here. As UART output is still useful, I have one “development” variant with leads from an FTDI connector soldered to the GND/RXI/TXO esprog pads. Oh, and I also have one Commadorable 64 board with a female header for testing the ILI9341 modules before soldering them. If you have any questions about building the boards, sound off in the comments below.

Code and schematics on Github, as always.

Bridging ISM radio and wifi for lunch money

The ESP8266 has taken the maker community by storm and the hype is well deserved. Before the ESP we had the HopeRF ISM radio RFM12 and its successor RFM69. So is the ESP8266 an RFM69 killer? I would say no. Hell no even 🙂 The RFM69 is still very well suited for certain applications and the ESP8266 will not run for 2+ years on a set of AA batteries. The two can however play nicely together as a low cost ISM/wifi bridge. I did a custom PCB for this in the shape of a somewhat large USB stick, dubbed “Espism”.

 

Currently it works as an ISM sniffer posting the received packets on the MQTT topic espism-<macaddr>. Packets are posted in hex followed by the RSSI value:

A set of four LEDs indicate received packets. Well three LEDs as I made a mistake on the ground plane. The MQTT server IP and RFM69 network information is hard coded into the binary.

I ported Andreas Heßling’s STM32 RFM driver to the lovely ESP Open RTOS, my swiss army knife for ESP8266 development. The type-A right angle 90 degreee USB connector and 3x6x2.5mm push button can be found for little money on eBay. The push button currently serves no purpose but the plan is to perform a “master reset” of the device using this button. The rest of the BOM consists of 0603 resistors and capacitors, an LM1117 3.3V regulator and a SOT23 P-mosfet for driving the 0603 LEDs. Oh, and the ESP12F talking to an RFM69CW. The BOM should add up to about the price of lunch.

Code and schematics on Github as always.

Factory programming ESP8266 gadgets

The FTDI connector can be found on just about any ESP8266 design. If you are building a gadget to be deployed somewhere and not a full blown development board, the FTDI connector is somewhat overkill. And it is quite large. A few pins could be shaved off but we still have a through hole connector invading the other side of the PCB.

I ended up designing my own connector and it has been used sucessfully in all of my recent projects. The connector consists of five test points providing power, GND, TXO, RXI and GPIO0 for boot control. It takes very little single sided PCB space and is inspired by the TagConnect I use at work. Note that the power provided through the connector is unregulated.

I also designed a pogo pin connector to mate the test points and a small board with a DC barrel connector and the FTDI connector. This board has two switches for power and boot mode selection.

If you look carefully on the pogo pin adapter you see that the power pin is somewhat retracted. As the adapter will be hand held, the four other pins can be aligned to the device and with a gentle push power will be applied.

The pins used are P75-B1 1.02 mm (40 mil) [eBay] and the 9x4x8.5mm 3 way switches are also on eBay.

Schematics and my Eagle library with the device connector (“ESPROG-DEVICE”) as always on Github.

Building the Esparducam

I have had some questions about the possibility to purchase Esparducam boards and also about the bill of material. While I am looking into selling spare boards, here are some instructions about building the boards. Here is the link to order the PCBs [dirtypcbs.com].

Bare PCBs

If you have never tried building surface mounted boards yourself I highly recommend you try it! I started here [nathan.chantrell.net] and googled my way from there.

Here is the BOM with some eBay links:

C1 1uF capacitor 0603
C2 0.1uF capacitor  0603
C3 1uF capacitor  0603
C4 10uF capacitor  0603
C6 0.1uF capacitor  0603
J1 6 pin 2.54mm male header (angle) [eBay]
JP1 8 pin 2.54mm female header (for the Arducam Mini) [eBay]
JP9 Power jack 5.5×2.1mm [eBay]
R1 4k7 0603
R2 4k7 0603
R3 4k7 0603
R4 4k7 0603
S1,S2 Momentary switch [eBay]
U1 NCP1117 (or LM1117) 3.3V regulator [eBay]
X1 ESP-12f

The following parts are optional depending on what you want to do with your board:

Reverse current protection

D1 SOD-123FL, schottky diode for reverse current protection [eBay],
If you feel brave you can bypass the diode by placing a blob of solder across SJ2 on the back of the board.

Adding motion detection

If you want to attach a PIR [eBay] you need:
J2 JST ZH connector, 3 pin [eBay]
R6 220k 0603
R7 100k 0603
R6 and R7 was going to be a voltage divider that I messed up leaving R7 optional. Please note that the PIR does not work at 3.3V. To bypass this without adding a 5V regulator I simply feed the PIR with the raw board voltage which in my case is 5V.

Controlling power to the Arducam Mini

If you want to be able to control the power to the Arducam Mini board you need Q2 and R5. If you feel ok to have power constantly enabled simple place a blob of solder across SJ1 at the back of the board.
Q2 P mosfet, SOT-23 [eBay]
R5 4k7 0605

External flash

The external SPI flash is also optional. Please note that the footprint is somewhat too narrow, some flashes might not fit.
U2 SPI flash SOIC-8
C5 0.1uF 0603

Adding header pins

These optional headers are for attaching add-on boards or pins for taking measurements
JP3, JP6 8 pin 2.54mm male header
JP4,JP5 8 pin 2.54mm female header

That’s it, good luck!

Building a low cost wifi camera

Update! Here is a post with the BOM for the project.

Sometime ago I came across the Arducam Mini which is quite a nice camera module from UCTronics. It is a small PCB with a two megapixel OmniVision OV2640 sensor, an interchangeable lens and an FPGA to do the heavy lifting of image processing and JPEG encoding. Priced at around 24 Euros (lens included) you can easily buy a few without hurting your wallet and combined with an ESP8266 you can build quite a low cost wifi camera. Or several. Because designing and building PCBs is both fun and inexpensive I designed a board to go with the ESP8266/Arducam Mini combo, aptly named the Esparducam. And uniquely named too, try googeling for “esparducam“. Heck, even the domain name is available at the time of writing 🙂

The Espaducam board
The Espaducam board

Anyhow. The Esparducam board is a development board for the Arducam Mini module and is quite well suited for ESP8266 development in general.

Espaducam with Arducam Mini module
Espaducam with Arducam Mini module

The board is powered through a barrel connector at a minimum of 5V (upper limit untested) and all the IO pins on the ESP8266 are available on pin headers. The double rows are intended for the design of small breakout boards that sit on the inner 0.1″ aligned headers while the outer headers allow for connecting logic analyzers/oscilloscopes and so on. The Arducam Mini module plugs right into the front header and the standard FTDI connector is at the back of the board.

Image quality is, imho, quite decent at this price point, here are a few samples.

An optional SPI flash can be mounted for image storage and you can connect a standard eBay PIR module to the white JST header next to the FTDI connector if you want to build a motion triggered camera.

I am no hardware engineer but if you are and you find any silly design mistakes please let me know.

Schematics
Schematics

You can order the Esparducam board form DirtyPBCs and I would love to know if you build one. I plan to build a few for house monitoring, kite photography, reading my water meter and whatever else I can come up with.

The demo application listens to port 80 for HTTP GETs and will capture and return an image. It also has a command line interface on the serial port and the command ‘upload:<ip number>’ will capture an image and upload it via HTTP. A Python script is included that will receive and display the image using your system’s default image viewer. Note that the demo application is just that, a demo application. It does not handle simultaneous clients, errors or anything else that occurs in the real world.

IMG_3761Lastly a note about the lens. It uses a mount called M12xP0.5 and there are plenty of lenses to choose between. The one included with the Arducam Mini module has about the same field of view as a normal 50mm lens on a full frame DSLR. I would recommend getting a 3.2mm lens or shorter for some more wide angle if you plan to use the module for surveillance applications. The 3.2mm lens (called LS-40136) can focus at a very short distance making it a candidate for water meter reading applications.

I have yet to try the even shorter ones like the LS-20150 at 2.8mm or the LS-40166 at 2.6mm.

The Esparducam turned out so nice it became my preferred ESP8266 development board, why is a different post.

Code and hardware schematics as always on Github.

 

 

A versatile ESP8266 development board

This is followup to my post about building a low cost wifi camera. I mentioned that the Esparducam board is well suited for ESP8266 development in general and here is why. In addition to the Esparducam board I also designed a number of addon boards. The boards are very small (21×26 mm) meaning you can fit two of them into a standard 50×50 mm PCB you can get produced for very little money. If you want to try a new component or connector and perhaps a newly designed footprint, make a “boardlet” and try it on the Esparducam.

The RFM69C breakout
The RFM69C breakout board

The “ISM boardlet” mounts an RFM96C for building a low cost ISM to Wifi gateway. The board has an optional LED (driven by a mosfet) for link indication. I ported André Heßling’s RFM69-STM32 driver for this board and even though I have not had the time to test that much, basic transmission works.

The ESP Pinlet
The ESP Pinlet

The next board, the esp-pinlet, serves as a test bench for ESP12 family modules. After soldering an ESP12e module to an Esparducam board I noticed it would not connect to my Wifi network. For the price of ESP8266 modules, I cannot complain about broken modules but I want to make sure the modules I mount on my boards actually work before soldering. So how do we test ESP12 modules without soldering? Pogo pins! The pinlet board has 1.02mm (40 mil) holes for pogo pins that allows for an ESP12 module to be firmly pressed against the pins while flashed and tested. You can find these on eBay.

Look ma, no solder!
Look ma, no solder!

Schematics on Github.

Update on April 27th

Th pogo pins I used initially where not that good as the needle like shape made them get stuck in some of the ESP12 modules. A much better alternative is the P75-E2 [eBay] type of pin (still 1.02mm / 40mil):

P75-E2 pins
P75-E2 pins

If you plan on building a pinlet board, make use of the fact that you get ~10 in each order to help with alignment.

Pin alignment
Pin alignment

The stack here (top to bottom) is the board having the pins mounted, a spacer board (the red one), five pinlet boards for alignment and at the bottom one board flipped upside down to keep the pins from sliding downwards. The package is fixed with tape and ready for solder.

Commercial pilots control my moodlight

Having spent some time building the Wifi Ghost I wanted it to be something that was actually used. Few people in the house found the interest to change color on a daily basis (myself included). Then it occured to me, why not let the pilots of the aircrafts buzzing around the airspace of southern Sweden control it? They will probably never know that by passing within a few kilometers of my ADS-B receiver they will light up my study.

This will be a small project as most parts are already in place. The ADS-B tracker from my Skygrazer project will feed a script that sets the ghost color via its MQTT topic. What color though? Well, the most prominent color in the airlines’s logo of course! Make a Bing image search for the name of the airline with the word “logo” appended, pick an image, download and analyze. The color will be dimmed according to the distance to the aircraft. I use a maximum distance of 2 kilometers making the light fade up and down whenever an aircraft passes near my house.

The result? A wifi ghost light put to good use. And art 🙂

Code available on Github.

My wifi ghost lamp

Sometime ago all wifi hobbyist projects where quite expensive. USB Wifi dongles could be found for a handfull or dollars apiece but something easily connectible to a micro controller was also “connected” with a hefty price tag. Then the ESP8266 surfaced…

Having just purchased a Pac Man ghost LED lamp on the Black Friday sale I quickly saw an application for the ESP8266. Nothing novel, nothing that hadn’t been done 100 times before but something fun.

 

Make the ghost green
A warranty waiting to be voided

The software part

Following in the MQTT footsteps of previous projects I decided against running a server on the ESP8266 listening to yet another protocol implementation. Instead the ghost would listen to an MQTT topic and light up accordingly. I also wanted it to be able to run preconfigured light shows. The ESP8266 runs tuanpmt’s MQTT implementation and listens to the topic ghost/led sending anything it receives to the Arduino which responds to the following commands:

  • #RRGGBB – set all LEDs to specified color
  • :nnRRGGBB – set LED nn to specified color
  • – update the LED ring with all LEDs set with the :nnRRGGBB commands
  • p01 – run “light show” 01
  • * – turn all LEDs off

The “anything it receives” means I can add functionbality on the Arduino without touching the firmware on the ESP8266.

The hardware part

The hardware consists of the following:

  • ESP8266-01 board
  • Arduino Nano
  • 16 LED Neopixel Ring
  • Level shifter
  • 3.3V regulator with buddy capacitors
  • 1A USB charger

I purchased an Adafruit Neopixel ring with the lovely WS2812 LEDs. To save some time I took an Arduino I had lying around to control the LEDs using the Adafruit library. The two systems talks over UART. The Arduino runs at 5V (the level at which it can control the Neopixel ring) and the ESP8266 run at 3.3V which means a level shifter needs to be placed between the two. You can find level shifters almost for free on eBay. The wiring is quite simple. The USB charger provides 5V for the Arduino, the Neopixel ring and the high side side of the level shifter. The regulator provides 3.3V for the ESP8266 and the low side of the level shifter. I threw everything together on a prototyping board, nothing will be visibe anyhow 🙂

Once wired up the ghost can be tested with the command

The hard part

The board sits on nylon spacers to be glued to the lamp base
The board sits on nylon spacers to be glued to the lamp base

Now for the hard part, mounting the hardware inside the ghost. The ghost case is made up of three parts. The dome, the base and a bottom plate where the electronics is attached. The bottom plate is attached to the base using screws and the base is glued to the dome. This leaves the screws on the inside meaning the ghost cannot be cracked open without causing permanent damage. Using a fine saw and a drill I removed the bottom plate, sanded the edges and rinsed the dome in water ro remove the plastic dust. The electronics is mounted on spacers on the bottom plate and I used silicone to reattach it to the dome. It stays in place and reopening should not be that hard.

More software

Controlling the ghost via the command line would not attract much venture capital so I set out to make an iPhone app for controlling the ghost. NKOColorPickerView and MQTTKit fit the bill and resulted in this neat little app I installed on my son’s iPad.

Make the ghost green
Make the ghost green

He was somewhat impressed and have changed the ghost color about three times to date which was in line with my expectations. I do have other plans for the wifi ghost, but that’s for another post.

Code available on Github

Final thoughts

In the time between finishing this hack and actually writing about it, Arduino on the ESP8266 has matured phenomenally so today I would skip the AVR. Actually I could replace all the hardware with the WifiPixels.

Gallery

A wifi OLED display for my wife

Somehow, the cord to the external temperature probe got ripped the out of the temperature display in the bedroom. My wife insisted on us purchasing a new thermometer but as an engineer I immedietaly saw the opportunity to build hardware and write software. Spending lots of time and resources on “engineering joy” is not something one can do at work but in one’s sparetime the sky is (almost) the limit.

So instead of spending about a dozen Euros on a new thermometer I designed and built a PCB and wrote code which was a lot more fun and educational. And way more expensive 🙂 The result is the Wife OLED that displays the current outside temperature as well as the forecasted temperature in 8 hours. While the morning might be cold, it is nice to know what the temperature will be at lunchtime.

WifeOLED
Another ESP8266 MQTT OLED display, on the warmest day this summer!

As the OLED display would be always on and close to a power outlet I choose a wifi solution and went for the the ESP8266, more specifically the ESP-03 module for its small size. The OLED was found on eBay, is a mere 0.91″ large and has an active area of 128×32 pixels. The device runs from a USB charger and an SPX3819 LDO provides the 3.3V the ESP and OLED needs. I designed a PCB in Eagle and had DirtyPBCs.com produce it. As the PCB is quite constrained on size there is no full FTDI-style connector. The RX/TX pins and ground are the only ones available for programming and a small tactile switch is used to get the ESP8266 into download mode.l

Looking at the software side, it turned out most of the work had been done by Nathan Chantrell (and others). He used a 128×64 pixel OLED display and the driver seemed to originate from the Arduino OLED driver by Adafruit. As I had chosen a 128×32 pixel display the driver needed some work. Also the available fonts where too small to be readable from across the room so I rendered Ubuntu Condensed in 28px and 32px. The larger font will be used for displaying the current temperature and the smaller one for the forecasted temperature. The device subscribes to the MQTT topics home/temperature/outside and home/temperature/forecast and displays whatever arrives on those topics.

The current outside temperature comes from my setup with a Tiny328 node equipped with a DS18B20 probe and a Raspberry Pi gateway (a future post). The forecasted temperature is pulled from the open data feed of the Swedish Meteorological and Hydrological Institute (SMHI) using the script get-weather-smhi.py.

The HW schematics (and gerbers!) as well as the SW is found on github.