Wednesday, March 1, 2017

Comparing Microcontroller Wi-Fi Solutions, 2017 Edition

One of my most popular blog posts cataloged a selection of popular wi-fi chips and modules available for providing wireless in a microcontroller project. Some solutions can be microcontroller and wi-fi all in one. Some are expensive, some very affordable.

Today I present a new comparison chart. It has many more products. And an accompanying chart lists available development boards that implement one of the wi-fi solutions so you can buy one and use it yourself (if the wi-fi solution is a hard to use chip or module). Many companies offer products using the available wi-fi chips so the developer or hobbyist can access it effectively. Or to add a microcontroller to provide a development solution.

I will paste pictures of the spreadsheets below. They will be too small to use so there are duplicates at the bottom in full size for practical use.

The 2017 Wi-Fi solution comparison chart (use the full size chart below for practical use)
Note: When I compare a vendor solution, I try to get the smallest "unit" available, re. if the chip can be purchased, data is on the chip. If the solution is a module, then info is on the module. Finally, for something like Edison, it is basically a full wi-fi enabled compute solution. Use the second table to find some of the commonly available boards that may be purchased for developers and hobbyists to use:

Boards that use the Wi-Fi solutions in the first chart (use full size image below for real use)

Now that you know you have a hard time reading those, here are the full size versions to study:

The 2017 Wi-Fi Solution Comparison Chart


The 2017 List of Products Using the 2017 Wi-Fi Products Compared



Please note that this information may be used by you and others under the
Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) License.
Mainly: please cite me and a link to this blog if you share the information. It takes a bit of research to pull together, so I provide it for your use, just let others know it was me who compiled it.

If you find this helpful or find issues, leave a comment in the blog.

Sunday, February 12, 2017

Pi Supply / Adafruit PaPiRus Zero ePaper/eInk pHAT v1.2 Setup

I recently bought a Pi Supply PaPiRus Zero ePaper/eInk pHAT v1.2 from Adafruit. I went to the Pi Supply website but the documentation was not so good. And even going through the PaPiRus GitHub instructions, I had issues with my board not working right that required tech support from Pi Supply. I finally got it to work, so I'll list my success for others.

If you have any other driver board that is not the Pi Supply PaPiRus Zero ePaper pHAT v1.2, you'll want to look at the end of this post for pointers to resources that might apply.

Measure the Display Size


The display and board Adafruit currently sells is the 2.0 inch board. I had originally thought it was the small 1.44 as that is what the Pi Supply site had on it but I hadn't measured the display (Adafruit correctly says 2.0"). Here is the diagonal display measurement you should make. If you don't have an inch ruler, divide the number of centimeters by 2.54 to get inches. The PaPiRus Zero should have a 2.0 inch display.

Measure your display from far corner to far corner diagonally. This one is 2.0 inches. Ruler by Adafruit.
If your display measures different from 2.0 inches, your settings and configuration may need changing.

Jumper Setting


It is important to set the jumper across the pins on connector CN2 correctly so that the board handles your display correctly. If this is set wrong you'll get unwanted lines or behavior of the display.


  • Jumper pins 2 and 3 for a 1.44" or 2.0" display
  • Jumper pins 1 and 2 for a 2.7" display
  • Take the jumper off (or just have it on pin 1 and off 2 and 3) for a 1.9" or 2.6" display

The board Adafruit ships is the 2.0 inch. So you want the jumper looking like this:


Board to Display Connection


To open the connector at the back of the PaPiRus board you need to lift the dark brown clip on CN1 by using your fingernail to grab the dark brown part on the end of the board and rotating up gently allow it to rotate over its hinges until it is perpendicular to the board. The brown part clips on the beige one so it is normal for it to give a slight resistance when opening the connector. The pictures are copyright so you'll have to look at them on the link below:

See the pictures on the Pi Supply PaPiRus Assembly Tips and Gotchas page.

With the connector open, slide the cable on the beige part of the connector and gently push it so that it reaches underneath the brown clip. Make sure that the cable is inserted evenly so that when the clip is rotate back into the closed position the two dots shown in the picture are parallel with the connector.

This is one of the main causes of the screen not operating correctly so make sure you pay particular care when plugging the screen into the ribbon connector CN1.

Once the cable is in the correct position, rotate the brown clip into the closed position. You will notice that it will provide some resistance but this is absolutely normal.

See the pictures on the Pi Supply PaPiRus Assembly Tips and Gotchas page.


Standoffs and Sticky Tape

Take the two bits of sticky take and put them so they hold the display down. Be careful, removing the tape later is very hard and not recommended.
You have two squares of tape to hold the display down.
Connect the two plastic standoffs to the display pHat board (be careful to not damage the display).

At this point, your Pi Zero must have the GPIO pins added. You need to order this separately from the Pi Zero and the display pHat. At Adafruit it is part number 3335, at Pi Supply it is here.

You can follow this Instructable on soldering the header onto your Pi Zero. You will need solder, a soldering iron with a fine tip, some tape or Blu Tack to hold the header while soldering and some patience.

When you have the header soldered onto the Pi Zero, you can connect the display pHat board to the Pi Zero GPIO header to make a circuit board sandwich. Ensure the pins of the Pi line up with the pHat socket. Use the last two plastic screws to secure the Pi to the standoffs. The boards should be well connected now.

Software Installation

Install Raspbian on a micro SD card

If you don't have a micro SD card set up with the Raspbian Linux operating system, see this Adafruit tutorial on how to get it and set it up. Other operating systems like Arch Linux are not supported by the software driver, if you don't use Raspbian you're on your own.

You'll need to do some more set up for the display below. 

Connect a display and keyboard to your Pi Zero (Adafruit and Pi Supply, among other shops, have adapter cables for mini-USB to USB/VGA and micro USB to USB). For advanced users, you can log in via another computer via the SSH protocol with a USB to micro USB cable, tutorial here

Log into your Pi Zero, the default is username Pi, password Raspberry. Best to change the password at some point, remember the password if you do change it.

Enabling SPI and I2C interfaces on Raspberry Pi

Before using PaPiRus, you need to enable the SPI and the I2C interfaces which talk between the Pi and the display. You can enable the SPI by typing sudo raspi-config at the command line and then selecting Interfacing options > SPI and then selecting Enable. Without exiting the tool still in Interfacing options > I2C and then selecting Enable.

Setup PaPiRus Software

Run this line and PaPiRus will be setup and installed

curl -sSL https://goo.gl/i1Imel | sudo bash

You'll see alot of text scroll by as the software installs, that's normal.

All of the software will install in a directory named PaPiRus

Commands to Run

Select your screen size for the 2.0" display

sudo papirus-set 2.0

For other sizes, it works with papirus-set [1.44 | 1.9 | 2.0 | 2.6 | 2.7 ]

Write data to the screen

papirus-write "Some text to write"

Clear the screen

papirus-clear

Draw image on the screen

papirus-draw /path/to/image -t [resize | crop]

The PaPiRus can only display Bitmap images (.BMP) in black and white (1 bit colour). If you pass an image to PaPiRus that is not a 1 Bit Bitmap, it will automatically be converted to this by the software. However, for best results and higher image quality we would recommend that you convert the image to a 1 Bit Bitmap before pushing to the PaPiRus screen using GIMP or Photoshop or similar photo editing tools.

The default bitmap sizes for the different displays:

1.44"     128 x 96
1.9"      144 x 128
2.0"      200 x 96 - The Raspberry Pi Zero kit at Adafruit
2.6"      232 x 128
2.7"      264 x 176

More commands are listed in the Github repository.

Code

For using the display with Python see the official GitHub software repository.

The documentation is on both the README and in the repository wiki.

Wrap-up


I hope this has been useful. Here are some resources this is drawn from:

Saturday, February 4, 2017

Can Raspberry Pi Zero Take Arduino Projects to New Greatness?

Although Arduino prices have gone down from their $35 price a couple years ago, they are still in the $20 range. This affects the cost of projects built with Arduino.

The Raspberry Pi Zero was introduced a few months back at an affordable $5 price point. Many, many articles have been published trying to compare the Raspberry Pi boards with Arduino. It is mostly apples vs. oranges. Why?

The Raspberry Pi boards are full Linux computers in affordable packages. Arduino is a microcontroller platform with great ease of use. Each has their strengths and weaknesses.

What I'd like to focus on is the Raspberry Pi Zero. We are starting to see more projects that use the Zero where previously you might have used an Arduino. Why would people do this? Is it appropriate everywhere? No. Let's see where a Pi might be more applicable than an Arduino.

1) Memory is more plentiful on a Pi. Doing some large number of things or controlling a large number of RGB LEDs for example, you can run out of memory on many Arduinos. Not so on a Pi.

2) Displays on Arduino tend to be small as it requires buffering in the microcontroller (memory intensive) or via a separate display with memory buffer (expensive). All Raspberry Pis support both HDMI and composite video.

3) Networking via wired or wireless is available on Arduino. But it isn't straightforward and the user must process a lot of things. Linux was born in the network world so there is a great deal of software built in to handle communications. All Pi models except Zero have a network jack, The Pi 3 has wireless. Pi wireless via USB us fine as software is usually available.

4) Audio is possible on Arduino with separate add-ons. It is built into the Pi. Recording audio is near impossible for any length of time due to memory but replay of wav files on SD card works fine as long as you are not doing much else.  If you use a Pi Zero, the best audio takes an add-on board also.

5) Size matters, and the Pi Zero is smaller than many Arduino boards.

6) Software: nearly any software package that has been written on a Linux system (apart from large server applications) often will run on a Pi, It is harder writing some complex specialized input/output programs or drivers that may not be available already. Use of Python easy, C and C++ is ok, specialized languages like Javascript, Perl, Ruby, PHP are all available. BASIC, FORTRAN, etc. can be found but they are not Pi optimized.

Where the Arduino wins over the Pi:

1) Analog input/output - the Pi series has no built-in analog inputs.

2) Real-time control - the Pi has Linux overhead so anything needing strict timing is better on Arduino if it fits.

3) Software: a huge amount of real-time software libraries have been written, mostly in C/C++. There are other languages like Micropython available but they are not widespread.

I'm a firm believer in taking a look at all available hardware and software to be informed on what is best for the application. I know something like the Pi 3 or Pi Zero will not be a replacement for an Arduino for some applications. But the Pi price point and capabilities makes sense for some projects that might take an Arduino with several add-ons or a more expensive variant.


Sunday, January 15, 2017

Updating Wi-Fi Chips and Modules - Draft

I'm doing an update to my summer 2015 comparison of Wi-Fi boards boards for micro projects.

For this round, I'm breaking things up to a listing of chips and modules used, then a separate listing of popular breakout boards for those chips. So for part 1, I've developed a draft table of popular chips and modules.

I'm soliciting comments as to additions, changes, etc.


If the blog isn't displaying it well, here is the direct link: https://4.bp.blogspot.com/-f_XHmZ-JL9k/WHt6G4GxIJI/AAAAAAAAPGk/tL1ldiI-sbAmhYi8AZw7ohb01AE30XbxACLcB/s1600/wifi.PNG

Version 1/15
Link https://4.bp.blogspot.com/-VPa-T0Ej_hM/WH0RS7j_UCI/AAAAAAAAPHQ/Ic7jezGYZgwkCwrQPfrT-dQOFYHuCRNNACLcB/s1600/wifi2.PNG

Friday, January 13, 2017

Arduino as a Microcontroller Reference Platform

The Arduino line of microcontrollers has, arguably, been the spark that brought programmable hardware to Makers worldwide. This article takes a look at how Arduino furthered the use of microcontrollers and how it is important defining standards today.

Arduino dates back to Hernando Barragán's design of the Wiring platform in 2004. In 2005, Massimo Banzi, with David Mellis forked the Wiring source code and started running it as a separate project. Arduino use grew through successive product releases including the Arduino Diecimila, Arduino Duemilanove, and the baseline Arduino Uno board series (in its third revision). The evolution set the Atmel ATmega328P microcontroller in the Uno to become the microcontroller standard of its time.
The Arduino Uno R3 (photo via Adafruit)
The ecosphere of Arduino, consisting of the circuit board and Arduino Integrated Development Environment (IDE) became very compelling for developers. Many software libraries were created to extend Arduino software capability and hardware connectivity. This growing capability launched the ATmega328 into many project designs. The success of the Uno board design led to other companies and makers to make Uno compatible boards based on the '328. The price of the Uno was set at the time at $35 and it did not go on sale often, requiring an investment on the purchase of each board.

In expanding the Arduino product line, the Arduino team introduced other boards based on newer microcontrollers. Some have been more widely adapted into maker designs than others. Many software libraries required changes to support different microcontroller architectures.

The development of the Atmel ATmega328P has evolved from the ATmega168 and smaller ATmega8, which all use the Atmel's AVR architecture. The '328 chip runs at a nominal 16 MHz (on the Uno) with 32 kilobytes of flash memory. This is modest by computer standards, but this chip equalled much of the industry when it was introduced.

The Arduino team, in looking for better designs, introduced the Arduino Leonardo. Leonardo was based on the Atmel ATmega32U4 microcontroller with the same 32kB of flash at 16 MHz. The chip was mostly compatible with the '328 but also had the feature of native USB controller onboard, eliminating the need for a separate USB chip on boards such as Uno. The Leonardo was less popular than the Uno but found some interesting uses due to features not found in other microcontroller boards. The native USB was very popular with other company/Maker board designers who, to this day, use the ATmega32U4 and the Leonardo software to make compelling microcontroller boards at a low cost.
Arduino Leonardo (photo via arduino.cc)
Sadly the Leonardo has been discontinued by the Arduino team but the use of the ATmega32U4 lives on in many new designs.

The Arduino Due was the Arduino team's first commercial step into the Atmel SAM architecture chips. SAM features an ARM processor, capable of speeds much higher than the Uno/Leonardo 16 MHz and also capable of more flash and other compelling features. The Due, being the first Arduino SAM board did (has) not find (found) a wide following in products or maker projects but it did (has) start software migration of the Arduino software base to use non-AVR chips. (Note: While announced as discontinued, they are still available via arduino.cc).

Note: Yes, I am skipping some Arduino releases here and there which are also AVR based designs.

The Arduino Zero, beta tested in 2014 with release in 2015, has become the new tier for microcontroller designers. Based on the newer Atmel/Microchip SAMD series, the board provides the SAM higher clock rates, ARM core, and a much smaller size.

Microchip recently bought Atmel, hence the processor provider name change.

The Zero has not supplanted the venerable Arduino Uno, yet, but the day draws closer where there are no arguments for selecting the more modern chip. Variants are smaller and much easier for manufacturers to incorporate. The Arduino Zero software is defining a new generation of compatible boards, especially from Adafruit.com which is revising a number of their microcontroller boards to use the SAMD chips. The third party boards are often less expensive than the Zero as the Zero design uses an additional debug hardware chip not used by most hobbyists.

It is conceivable that Microchip may look to discontinue AVR production through price hikes, leaving the SAMD and possibly their own PIC lines more widely available.
Arduino Zero (photo via Adafruit)
Where does the flood of Arduino compatibles leave the Arduino team?  Actually in a fairly good spot. The team are the Research and Development group foremost, providing both the low level chip firmware and the ever more powerful IDE to tap into new chips. The Arduino team continues to bring forward very compelling boards in different form factors: the Arduino Zero, MKR1000, and MKRZero boards have a great amount of capability at a cost lower than the Arduino Uno of old.

The Arduino team also has been collaborating on non-Microchip boards, including Arduino Yun, Arduino 101, and others. They also are important in expanding both the capabilities of the Arduino ecosphere and in partnering with companies other than Microchip to include Intel. The ability to easily use new, powerful microcontrollers and Linux based processors only benefits the ability of both companies and Makers to use the newer processors.

We all can look forward to the growth of the Arduino family tree, which has grown from a seedling over ten years ago. The innovation of the Arduino team has enabled people worldwide to harness some incredible hardware in making incredible products.

Wednesday, October 12, 2016

Videos on My New Tone Controlled Robot

I have been working for awhile on an Adafruit Circuit Playground simple robot, mainly controlled wirelessly via sound.

Cute and capable
The whole tutorial should be out soon, but here are two of my Youtube videos showing the robot.


Here is the bot controlled via two whistles (harder to do than using a tone box):

Saturday, September 3, 2016

Microsoft: Refrigerators, not now - IoT Basics, yes please

Microsoft and Liebherr announced yesterday they are collaborating on a new "SmartDeviceBox" that allows the kitchen appliance to remind people what they need at the market, Microsoft principal data scientist TJ Hazen said in a blog post.

Fir now, let's not make jokes about your refrigerators updating at bad times or having blue screen of death episodes.

Rather, let's connect this announcement with an article that was published by former Apple executive Jean-Louis Gassée (link here). Most Internet of Things watchers are very skeptical right now. With some companies discontinuing the services behind their products and support often horrible, the consumer space has been very mixed. And some of the ideas are just not well thought out.


Gassée states 'The IoT randomly works. Devices stop and restart, they require visits to unsupportive customer support pages and helpless Your Call Is Important To U.S. help lines (and now we have chatbots). If you think I exaggerate, google “Nest trouble” or “smart bulbs trouble”.... Companies buy the cheapest possible processor, grab some software from the open source shelves, throw on a skimpy UI, hastily assemble and test, ship it.' Then he states "After a device has made it to the market, the real fun begins. Software updates are a problem when your connected lock or your connected car is in the middle of an update and you need to get in the house or drive to the emergency room."

If you look at my favorite vantage point, security, on that topic Gassée writes "Then there’s the truly ugly side of Consumer IoT: security, or the lack of it. The lackadaisical, to be polite, approach to software leaves many connections open to hackers who can see passwords exchanged in clear text on home WiFi while they sit in a car parked outside the house. Or we see that 100M Volkswagen cars are open to wireless hacking."

Then let's look at standards.

On Twitter, Alasdair Allan (@aallan) states: The #iot has 3 problems; security, refresh cycle, and standards. Of these standards least important, but only one the Valley cares about.

Companies don't often want cross-company standards. The classic "if we build our own ecosystem, we can keep people buying only our products" (examples: Nest, Apple).

Ok, so much for the doom & gloom (for now).

Getting back to Microsoft. They are jumping on refrigerators and cars and what not. But this is the perfect opportunity for Microsoft or whomever to be a pivotal group in spurring the Internet of Things. How? Make it easier for people. Connecting IoT devices to the home and talking to each other is currently hard. Microsoft knows this space, they can make it easier for us. Take Windows 10 IoT and double the staff and tie them into your research group.  Make It Simple is the goal.

I never want to have to reboot my GE smart bulb, certainly not having to do this manually, that is not asking too much. If Microsoft got IoT basics right, it wouldn't matter if company X did a great Kickstarter, then 2 years later went out of business - if we had common basis, things would still work in a standard way which communicates in a way that is easy to use (thanks to Microsoft or whomever heeds this).

A starting point. Integrate the DynDNS type service in. Microsoft did it for Windows Home Server, they know how.  Bake it in. Keep building in the simple, positive steps.

We didn't go to the moon on the first launch. Microsoft and others, ensure you build a standards compliant base which includes security and intercompatibility, for IoT to grow on.