Thursday, December 24, 2015

Beginner's ESP32 guide to getting started

Beginner's ESP32 guide to getting started


Yours truly is one of the lucky 200 to receive an ESP32 for beta testing. The neat little package came few days before Christmas. indeed, Christmas came early! It is a tough call, wrestling with the decision to roast the bird for Christmas eve dinner or to explore the ESP32. The latter won! we shall have chinese takeaways for dinner later.

A little bit of trivia. Back in June15 at MakerFaire Shenzhen, yours truly was sitting in the same row with the real mccoy https://twitter.com/ceo_espressif whom created the ESP8266, listening to the real arduino https://twitter.com/mbanzi giving a keynote on the yet to be released Genuino, and not forgetting yours truly getting his paws on the newly released nodeMCU v1.0 (black) http://shin-ajaran.blogspot.sg/2015/09/stream-iot-... from "zhao zhong 赵总" at a very competitive price.

ESP32 was featured on MAKE, Hackaday, and Adafruit. Do check the reference section for the details. Conventional wisdom assumes ESP32 is going to supersede the hugely successful ESP8266 for IoT application. But yours truly begs to differ. ESP8266 is targeted at the "everything" market, where gazilllions of IoT enabled sensors aka "throwies" are deployed to form an ubiquitous computing framework to collect data on just about anything! A plethora of boards manufacturer have utilized the ESP8266 in their respective iteration of IoT with cloud offerings. Hence the "everything". The ESP32 sports much bigger processing power, more RAM, and most importantly encryption at hardware level. Perfect timing to address the insecurities in the IoT devices sending data in clear text over the network via http or mqtt. ESP8266 is going for USD4 (got it for SGD9 at 2014). Unfortunately, the users (yours truly included) do not have the slightest hint on the price for the ESP32.

Below is a quick summary of the ESP32

Faster WiFi: Wifi has been upgraded to support HT40 speed (150 Mbps)
Bluetooth Low Energy (BLE) and Classic Bluetooth
Dual processor: 2x Tensilica L108 processors clocked at up to 160 MHz
Low Power Mode: deep sleep, etc.....
IO: Capacitive touch, ADCs, DACs, I2C. UART, SPI, SDIO, I2S, RMII, PMW
RAM: 400 KB on-chip RAM
Security for IoT: Hardware accelerated AES and SSL, etc

If you could recall about a year or so when ESP8266 was first released, the lack of proper, consistent, and precise documentation in the English Language has led to many frustrations among the early adopters. Great progress we have witnessed in 2015 for the developments of the ESP83266 by the members of this community. Makers alike, yours truly paid his due diligence in sharing a how-to guide on instructables http://www.instructables.com/id/noobs-guide-to-ESP... to address the inconsistency. This time round with ESP32, the documentations are much better!! Sorry, could not share the documentations now due to confidentiality. Let's wait for the full release straight from the horse's mouth. IMHO the documentations can still be a steep learning curve for the beginner. Furthermore, the QFN -ish packaged ESP32 chip that is fully assembled on a breakout board sports a 1.27mm (50mils) spacing between the pins (pitch) on the supposedly breakout board. It is very intimidating to solder onto the other provided breakout board to make it breadboard friendly. A beta tester has reported on an unfortunate event of damaged ESP32 http://esp32.com/viewtopic.php?f=2&t=41. Another beta tester have used the solder paste + heat gun method https://harizanov.com/2015/12/esp32/

This i'ble is an ongoing process aims at addressing the following

0. prep the ESP32 breakout board for prototyping on a breadboard

1. initial powering up and observations

2. setting up of programming environment + hello world

3. references

Soldering the ESP32 breakout board




parts needed
1. a 200 DegC temperature regulated, very fine tip solder iron, and 0.4mm solder.

2. heat gun. optional. useful if need to remove solder for SMD re-soldering work

3. soldering wick

4. solder flux and applicator

5. PCB vice of some sort

check out the annotations in the picture for a visualization on items needed

methodology

1. Practice some surface mount soldering before committing. yours truly only have 1 eval unit and can't afford to screw it up. If you have soldered ESP-12 and it's breakout board, it is definitely good experience. HIghly recommended to do SMD soldering in a well lit work area.

2. The ESP32 break out board moves around easily on the breakout board for breadboard. A tape of some sort is used to secure it in place. Make sure the pins are aligned properly on the 3 sides. Perhaps some heatsink compound can be applied on the small square on the breakout board for breadboard, and then the ESP32 board aligned on it. The tackiness of the heatsink compound will help to make the ESP32 stay in place.

3. Always ensure the pins are perfectly aligned on the ESP32 board to the breakout board for breadboard that is secured with a PCB vice. Apply solder flux on the soldering surface. If you are right hander, positions the pins to be soldered to be on your right hand side, such that your soldering movement is moving towards the right, bring the melted 0.4mm solder perpendicularly away from the neighbouring pins. 1.27mm spacing can be quite nerve wrecking to solder, and the random thoughts of screwing up is so strong! stay focus!

4. start soldering from the ground pins. Refer to the pin out diagram, there are 3 of them, one on each side of the ESP32 breakout board, and located at a convenient corner. Speaking from yours truly own experience in soldering the ESP32, if one of these is screw up, still have 2 more to go :) Once the 3 ground pins are soldered, the ESP32 should be perfectly aligned and sits securely on the breakout board for breadboard.

5. repeat step3 until all pins are soldered

Examine the solder work


Examine the SMD soldering under a magnifying glass for dry joints. Excess solder is fine as long as it doesn't overflow to neighbouring pins. A smartphone camera with it's magnifying function works well too.

It is recommended to fix the dry joints with another round of soldering.

If there are excess solder onto the neighbouring joints, use the soldering wick and heat it up with the solder iron or hot air gun to remove the excess.

once satisfied with the SMD soldering work, continue to solder the PTH male header pins.

check out the pictures for details

Powering up the ESP32 with CP2102 for the first time





Parts needed

1. CP2102 or any USB to TTL device

2. jumper wires

methodology

1. connect 3V3 and GND from CP2102 to ESP32.

2. connect TX of CP2102 to RX of ESP32, and RX of CP2102 to TX of ESP32

3. EN pin on ESP32 left floating ---> update: check out the next step for wiring a reset button

4. plug in CP2102 to USB port of computer

Observations

At first light, only the CP2102 lights up. yours truly thought he is going to have a piece of bricked ESP32 for Christmas, the thought of it is already depressing. As compared to the ESP8266 that sports a blue and a red LED, The ESP32 does not have any lights to indicate activity??? Upon further probing, under the wireless network of his win8.1, the ESP32 network shows up. what a relief :)

Putty with the setting of 115200 8 N 1 no flowcontrol is used to monitor the serial output of the ESP32 via CP2102. The screenshot here is so much different from Martin's. Not sure why is this so at the moment of writing -> update: check out the next step for wiring a reset button.

Powering up the second time with a reset switch



continuing from the previous step, some modifications to it.

the EN pin on ESP32 is pull high with a 10K resistor, and then grounded via push button switch to reset the ESP32 if asserted. Using putty with the setting of 115200 8 N 1 and no flow control, the same output is acquire as per martin's blog, just by resetting the ESP32 using the newly added push button. refer to picture for the details.

Setting up minicom



yours truly decide to setup minicom on ubuntu14.10 hosted in a virtual machine. Perhaps there is some command can be issued to the ESP32 to give the same output as martin's.

check out the screenshots for the commands and observations.

Still not a single clue of the debug message on the serial comm. Time to RTFM in detail.

Setting up the software enviroment & hello world


place holder for future updates

quick update1: the installation of the cross tool keeps breaking on a u14.04 Server 64bit hosted in a VM on w8.1. still probing around the error messages displayed

quick update2: after fixing some broken dependencies, finally the *.bin are compiled successfully. check out the screenshots. Next, need to figure out what's the functionality of the *.bin compiled from the provided "project_template". Then decides whether to upload to the ESP32 or otherwise. Still finding a way to "backup" the out of the box *.bin in the ESP32. just as an insurance to recover from mistakes.

Reference
MAKE: http://makezine.com/2015/12/09/meet-esp32-new-big-...

Hackaday: https://hackaday.com/2015/12/23/the-esp32-beta-uni...

Adafruit: https://www.youtube.com/watch?v=HCGHb0OVz1s

Martin's : https://harizanov.com/2015/12/esp32/

also on Instructables http://www.instructables.com/id/Beginners-ESP32-Guide-to-Assembly-Testing/

Thank you

thank you for coming thus far.

special thanks to

espressif CEO & reps for the ESP32

Mr.Dorville for the loan of SMD rework soldering station.

Merry Christmas 201

Friday, December 18, 2015

Lightsaber ala over-easy

running short of time to make a lightsaber to bring along to the cinema to watch the latest installation of starwars? fret not. you will make your own lightsaber in about 30 minutes or so and still able to make it in time to rescue princess leia. 
many years back, yours truly have made a DIY lightsaber with a differnt methodology, URL here http://www.instructables.com/id/DIY-light-saber-for/
In this guide, we will be making a lightsaber ala over-easy; we shall address the electromechanics needed to build a lightsaber with surpluses from previous project. The design of the lightsaber holder deserves an i'ble by itself.
lightsaber over-easy is de-constructed as per the following parts needed
1. a diffuser. In this i'ble i have used 5mm OD side glow fiber optics inserted into a 10mm OD acrylic tube.
2. a light source. There are 2 flavours here. one with a 3W blue LED, and the other with a lightsaber holder look-alike torchlight.
3. power supply. 5V from a mobile power bank made with 18650 cells or coin cells.
4. 3D printed holder of some sort to bind the diffuser, the light source, and the power supply.

a 5V USB power bank is used as the power source to turn on a blue 3W LED mounted on a heat sink.
Assuming the forward bias voltage is 3.3v, and ideal current of 350mA, i would need a 4ohm 2W resistor. I only have a 10ohm 2W resistor handy.
to construct the light source, these are the items used
1. small veroboard
2. 1x USB male connector
3. 1x 3W LED (BLUE) mounted on the heatsink, collimator (focus beamacr) is optional
4. 1x 2W 4ohm resistor
5. 1x usb mobile power bank made with 18650 cells
*note: the 3W LED and resistor get hot after several minutes of play.
The force must have led me to discover this lightsaber holder look-alike torch light that was well hidden deep inside the goods cabinet in the local hardware shop.
The acrylic tube inserted with the sideglow fiber optics is connected to the lightsaber holder look-alike torch light with a 3D printed adapter.
Link to the 3D model of the lightsaber adapter herehttps://www.tinkercad.com/things/2pGvKJvmqpj
check out the pictures for a detail description on the assembly


Do or do not, there is no try.