Monday, October 24, 2016

Introducing the ESP Widget

Well after much wrangling with the firmware code, I finally have a version that seems to be stable.  With this milestone out of the way, I feel it is time to show you my latest work.  I call it the ESP Widget.




It's a small USB-powered device that constantly retrieves information via Wifi and displays it on a small OLED screen.  It is built around a Wemos D1 Mini ESP8266 board and runs an application written in MicroPython.

Here is the actual schematic for all of the connections:


The case was 3D printed of course, which was designed in OpenSCAD.




It was a tight fit, and the wiring was a bit tricky, but with some tweezers it seemed to work fine,




The final piece of the puzzle was the firmware to make it work.  I will make another post about that.

Friday, October 21, 2016

Programming the Wemos D1 Mini

I have found that there are two viable choices for development (for me) with the Wemos D1 Mini... either the Arduino development environment or MicroPython.

ESP8266 Arduino
Having experience with Arduino is a big help when getting started using that approach.  They have already done alot of the work for you here http://www.esp8266.com/ and all you need to do is add

     http://arduino.esp8266.com/stable/package_esp8266com_index.json

to your board manager and then you can import the libraries.


There is an extensive list of examples, especially dealing with Wifi and Internet communications.

I'm really impressed with the Arduino support for my D1 Mini.  I can access all of my shields (except my neopixel shield) and the code is all C.  It works well and I have to say it would be my main development route if it were not for a couple of reasons.


  1. Deep Code Nesting.
    The libraries of course build on one another, and sometimes you have problems that originate, deep in the library code... which may or may not be C.  It could be C++ which is different.  I was getting errors at high level calls, but was unable to trace it all the way down to where I could understand the problem and fix or work around it.
  2. Difficult Debugging
    Similar to above, there were many reasons why it was hard to get something original big and complex working.



MicroPython
I am not a Python programmer, but am very interested in learning it because of all of its positive attributes.  As I am just starting out, I am copying code more than I am writing it, but I have to say it is a really nice language.

First of all, it is a much higher level of programming... so it takes less code to do the same things.  Instead of layer after layer of C code, it equates to one or two layers of Python and that's it.  Neat.

The second nice thing is that it is REALLY Python 3.0.  As I program the microcontroller, I am learning the "big" Python language as well. Bonus.

Finally, I am finding Python FUN!  After years of C# and VB.NET programming, I am enjoying the simplicity, the readability and the power of Python.


Thursday, October 20, 2016

Another Diversion

I guess it is in my nature to have more than one project going at a time.  While I tend to obsess, and focus on a single project during the duration, sometime I have to back away and do something else.

So, I have put off the final steps of building my Cherry 3D Printer, to work on another fun project.  This one is related to the Arduino, but is more closely described as an ESP8266 obsession.  This little chip is like a little Arduino with built-in WiFi capabilities and it only costs a few dollars.  It's great.

Wemos D1 Mini
There are actually many ESP8266 boards available, but the one I have settled on is the Wemos D1 Mini.  It's cheap at around $4 shipped and it has a nice ecosystem of shields that make it easy to experiment with.

There are shields for...

  • Lipo Battery powering and charging
  • SD Card shield
  • Relay Shield
  • Neopixel Shield
  • Button Shield
  • etc...
 

MicroPython
The best part about the ESP8266 is it's ability to be programmed in Python!  I am talking about MicroPython of course,  This great piece of software is an amazingly complete implementation of Python 3 for a microcontroller!

I will be documenting my experiments and projects coming up.  Exciting!