New RPi Zero W - with Wifi and Bluetooth

Anything not related to STM32
User avatar
martinayotte
Posts: 1172
Joined: Mon Apr 27, 2015 1:45 pm

Re: New RPi Zero W - with Wifi and Bluetooth

Post by martinayotte » Tue Apr 18, 2017 1:27 pm

You can also get some OrangePiZero for less than $8.00 including shipping, but no BT.

User avatar
mrburnette
Posts: 1783
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: New RPi Zero W - with Wifi and Bluetooth

Post by mrburnette » Thu May 04, 2017 2:56 am

The RPi Zero & Zero W are devices that are remarkable interesting due to the $5 and $10 U.S.D. pricing respectively. Here in Atlanta, two MicroCenter stores have the usually in stock, limit one (1) each per visit; so, a Zero & Zero W can be purchased once per day, stock permitting. Last week, I picked up a RPi3 for $29.99.

My initial, day 1, work with the W was very frustrating and carried over to day 2 and day 3. Normally, Google is your friend, but there is a tremendous quantity of just-wrong-information out in the Ether. Now, I am no stranger to UNIX or Linux but Raspbian Jessie is "cooked: just for the Pi's so one must understand that they are working with a streamlined Linux and that the SD card supports two (2) partitions, one dedicated to boot. Worst, the damn(able) Jessie boots initially to GUI which means you must rig up a serial console or you must have an HDMI monitor with corrects cables and a USB-micro hub for that keyboard and mouse! If you find yourself without all those cables, the Zero/Zero-W supports USB gadget mode to a hosting PC.

Having the user file system on flash is a real P.I.T.A. Many configuration files require "sudo" to edit... but, not all. Some configuration can be done through the utility raspi-config of which there is a GUI version and a CLI version, very similar but not 100% exact. Even the devout will learn to curse.

For all of your troubles, you get a remarkably powerful 32-bit Linux SoC with over 300MB of free RAM with X, VNC, and SSH all running. There is an Arduino core available or you can elect to write pure C/C++ and compile directly on the device... Geany is a decent enough IDE that runs nicely on the RPi Zero. From my article here.

C code to blink an RGB LED (common anode.)

Code: Select all

// blink3.c
//
// Example program for bcm2835 library
// Blinks a tricolor LED on an off every 0.5 secs (editable)
//
// Or you can test it before installing with:
// gcc -o blink -I ../../src ../../src/bcm2835.c blink3.c
// sudo ./blink3

// For Geany GUI IDE:
// 	Compile switches:  gcc -Wall -c "%f" -l bcm2835
// 	Build switches:    gcc -Wall -o "%e" "%f" -l bcm2835
// 	Execute switches:  sudo "./%e"
// YouTube vid: https://www.youtube.com/watch?v=jlM9KoWyPv0&index=5&list=PL-6WIzdGN7xQdIvyCtQUhmflKNsidxfwX

#include <bcm2835.h>
#include <stdio.h>

// modified mrb 20170419 for RPi Zero
// LED between common anode to +3.3 and Pin 12, 16, 18 to 330 Ohm to RGB of LED
// RPi P1_pin_12 == GPIO_18
// RPi P1_pin_16 == GPIO_23
// RPi P1_pin_18 == GPIO_24

#define RED RPI_GPIO_P1_12 // SAME RESULTS AS #define PIN 18
#define GRN RPI_GPIO_P1_16
#define BLU RPI_GPIO_P1_18

#define t_On	10
#define t_Off	300
#define Led_Off	HIGH
#define Led_On	LOW

int main(int argc, char **argv)
{
    if (!bcm2835_init() ) return 1 ;

    // Set the pin to be an output
    bcm2835_gpio_fsel(RED, BCM2835_GPIO_FSEL_OUTP) ;
    bcm2835_gpio_fsel(GRN, BCM2835_GPIO_FSEL_OUTP) ;
    bcm2835_gpio_fsel(BLU, BCM2835_GPIO_FSEL_OUTP) ;
	// LED used is a RGB with a common anode which connects to 3.3V
    // Therefore, any LED is OFF when the port pin is HIGH
    bcm2835_gpio_write(RED, Led_Off);
    bcm2835_gpio_write(GRN, Led_Off);
    bcm2835_gpio_write(BLU, Led_Off);

    while (1)						// Function same as loop() in Arduino
    {
	// LEDs illuminate when cathode is connected by output buffer to ground (sink)
	// ***WARNING*** a suitable current limiting resistor must be used (~330 Ohm)
	// RED LED on, wait, off, wait ... next color, repeat
	bcm2835_gpio_write(RED, Led_On);
	bcm2835_delay(t_On);
	bcm2835_gpio_write(RED, Led_Off);
	bcm2835_delay(t_Off);
	// Repeat for Green
	bcm2835_gpio_write(GRN, Led_On);
	bcm2835_delay(t_On);
	bcm2835_gpio_write(GRN, Led_Off);
	bcm2835_delay(t_Off);
	// Repeat for Blue
	bcm2835_gpio_write(BLU, Led_On);
	bcm2835_delay(t_On);
	bcm2835_gpio_write(BLU, Led_Off);
	bcm2835_delay(t_Off);
	}
    // Unless program responds to a Ctrl+C (break), the above loops forever
    bcm2835_close();				// housecleaning
    return 0;
}
So, the RPi Zero-W @ $10 is really more like $45 - $60 if you have to purchase a 16G class 10 SD card, HDMI cable, USB hub ... etc. This is a perfect example of the 'tail wagging the dog.' But, if you go 100% headless, now your cost drop to just the 5V wall wart (do no undersize ... 1A is not adequate IMO and 2A is what I recommend if you have anything other than a bare-board.) Once you get this little beast configured, make a back-up SD, and get around some quirts, you have a really nice little Linux board to run one or more custom application upon.

$10 and two long weekends... for those with well stocked cable boxes and little things like BT keyboards, etc. Otherwise, figure about $60 ... you may spend a little less, but you may spend more - for example, I purchased a 3.5" HDMI LCD for my testing jig.

Ray

User avatar
sheepdoll
Posts: 230
Joined: Fri May 22, 2015 12:58 am
Location: Silicon Valley Vortex
Contact:

Re: New RPi Zero W - with Wifi and Bluetooth

Post by sheepdoll » Thu May 04, 2017 6:40 am

I got a couple of Zeros last year. Connect one to an ADAfruit TFT while on a 10 day cruse between SF and Alaska. Not really much more than a novelty. Especially when one does not have a reliable network connection.

Last month I got a 7" display and a Model3-B. I thought the display would be HDMI. It only connects to the larger Pis. Was at the local makerspace rasp pi meetup last night. I connected the display up and it worked for the most part. Had to get a mouse out as the touchscreen was hard to use. Needed a keyboard to type commands in. I was able to run a java app.

Now if only there was a way to run similar stuff on my STMF746G-Disco. ST did release a Java Games demo for the STM32f4-discovery that I downloaded. The full java engine dev system is quite a few $$$ which makes no sense what so ever given all the open source stuff out there.

User avatar
mrburnette
Posts: 1783
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: New RPi Zero W - with Wifi and Bluetooth

Post by mrburnette » Thu May 04, 2017 3:50 pm

Had to get a mouse out as the touchscreen was hard to use. Needed a keyboard to type commands in. I was able to run a java app.
Been there! Having a USB mouse and USB keyboard within reasonable reach is absolutely necessary with the Raspberry line. For days, I would go in the junk closet, grab the mouse and keyboard, take it down to the lab, fix an issue, take the keyboard and mouse back to storage... repeat the next day or day after! Today the keyboard and mouse are thrown upon an already overloaded workbench.

The 3.5 HDMI HD screen for RPi 3 is currently on sale @ Amazon ... about 50% off and can be used independently for any HDMI input. Setting up the digitizer however was a P.I.T.A. When all was done, it all works as expected... but the 1920x1080 resolution with the RPi is just too small (cute, but small) ... young eyes may however work well with the HiRes.

RPi Zero W test board for GPIO
Image


Note: RPi Jessie initializes GPIO to input with pull-down (sink) resistors active; so observers noting the faint glow of the tri-color LED before activating the sketch will note the current is because of a common anode LED to Vcc.

However, when all is said and done ... the RPi 3 @ the $29.99 current MicroCenter price is a good buy and the RPi Zero-W is definitely a recommended buy IMO provided one is aware (acutely aware) that unless one uses the RPi headless, the cost just keeps climbing ... starting with a Class 10 SD card, then cables, then USB hub, then ...

Ray

User avatar
sheepdoll
Posts: 230
Joined: Fri May 22, 2015 12:58 am
Location: Silicon Valley Vortex
Contact:

Re: New RPi Zero W - with Wifi and Bluetooth

Post by sheepdoll » Thu May 04, 2017 5:49 pm

mrburnette wrote:Now, I am no stranger to UNIX or Linux but Raspbian Jessie is "cooked: just for the Pi's so one must understand that they are working with a streamlined Linux and that the SD card supports two (2) partitions, one dedicated to boot. Worst, the damn(able) Jessie boots initially to GUI which means you must rig up a serial console or you must have an HDMI monitor with corrects cables and a USB-micro hub for that keyboard and mouse!
Ray
The founder of the local makerspace Arron Newcomb just wrote a book for Arduino users who want to use Linux on single board computers such as the Raspberry pi.

It is called Make: Linux for makers ISBN 9781680451832
http://shop.oreilly.com/product/0636920031338.do

Aaron thought I would find in to introductory, I actually have been finding it useful and informative. It might help that I learned from his workshops over the last 6 months or so.

Almost everyone in the workshop wants to use the pi headless and telnet into it. There is a way to see the boot partition in a PC and change the options to got directly to terminal. He also recommends avoiding NOOBS as that is actually more work and harder to learn.

Aaron is not a big fan of the GUI either.

This week there were a couple of guys in the workshop who were waxing on how much they liked Emacs ...

User avatar
mrburnette
Posts: 1783
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: New RPi Zero W - with Wifi and Bluetooth

Post by mrburnette » Thu May 04, 2017 10:20 pm

sheepdoll wrote:
The founder of the local makerspace Arron Newcomb just wrote a book for Arduino users who want to use Linux on single board computers such as the Raspberry pi.

It is called Make: Linux for makers ISBN 9781680451832
http://shop.oreilly.com/product/0636920031338.do
Thank you. I'll check it out.
This week there were a couple of guys in the workshop who were waxing on how much they liked Emacs ...
Yea ... I had to write an Emacs clone back in a C class in the dark '80's. The supplied "nano" is OK for quick 'n dirty.
Aaron is not a big fan of the GUI either.
It's just lightweight and unless one intends on really needing the GUI (say, for Geany or Arduino) it is better to just put the SD into a Linux PC and touch a file named ssh on root. Put it back in the RPi Zero, boot, and SSH into with the user pi and the password raspberry. At that time, run the raspi-config utility as sudo and configure the darn thing... this is where (one of many places) that the boot to GUI can be disabled.

So, my deal with my previous statement is that there is enough of the raspbian OS there to provide critical Linux utilities, but perhaps not everything one would expect, Day 1. Loading too much junk runs the risk of having a utility that does not understand that it is working on a flash file system. The RPi Zero does seem to be particular about having a darn good quality class 10 SD card... cheap imitations simply become corrupted beyond fsck ability to fix.

Ray

User avatar
RogerClark
Posts: 5943
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: New RPi Zero W - with Wifi and Bluetooth

Post by RogerClark » Mon May 08, 2017 9:59 pm

For reasons I wont bore you with, I have been looking at open source android builds recently, and I came across a LineageOS ( Open Source Android) build for the RPI 3, which works quite well, albeit a bit slow.

I also notcied that Google themselves have a ROM download for the RPI 3 from their "Android Things" site.
However I think its binaries only.

From what I recall the Raspberian linux was the same ROM files for both the RPi 3 and the Zero W.
So when I get time I will probably try both the LineageOS and Android Things , ROMs , on the Zero W.


I am however, skeptical of how useful "Android Things" would be for anyone. IMHO opinion, it looks like another of the myriad of Glogle projects which Google briefly toys with, before abandoning.
But I suppose some companies may be heavily linked to the Android ecostructure and have a niche for this.

LinegeOS is probably not well suited to the RPi platform either, however as the sucessor to Cyanogen / Cyanogenmod, Its definitely worth a look if you have an Android phone or tablet, and would prefer a more open source alternative to the usual manufacturer's bloatware laden offernings.
However thats another story, and completely off topic ;-)

Edit.

I just did some research, and its not a dead cert that Android Things would run on the Zero W, because its based on Android 7, which is supposed to need an ARMv7 CPU, but the Zero W uses a ARMv6

However, I suspect this is just a compile switch, in the Android build, so I will give it a try and see if it boots (when I get a spare moment)

The same potentially applies to LineageOS, but I don't think I'm going to have time to try it on the Zero W, as I suspect its a waste of time because it will run too slow to be that useful

Edit 2.

Just tried Android Things on the RPi Zero W, but it didnt boot at all, so it looks like, its not currently compatible.

User avatar
mrburnette
Posts: 1783
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: New RPi Zero W - with Wifi and Bluetooth

Post by mrburnette » Mon May 15, 2017 3:57 pm

RogerClark wrote:For reasons I wont bore you with, I have been looking at open source android builds recently, and I came across a LineageOS ( Open Source Android) build for the RPI 3, which works quite well, albeit a bit slow.

<...>
Roger,
I'm sure you know that the Raspberry line of boards are quasi-Open Source; that is, the Broadcom low-level firmware is not (as far as I can determine) open: https://github.com/raspberrypi/firmware
firmware
This repository contains pre-compiled binaries of the current Raspberry Pi kernel and modules, userspace libraries, and bootloader/GPU firmware.
Depending upon the spirit of the Open Source target you are shooting for, this simply could be a brick wall.

I suspect that the Broadcom low-level code is just like Espressif's stuff ... considered proprietary and built with non-disclosure licenses. Personally I think this poo stinks to high-heaven. While I enjoy playing around with the ESP products, I would never seriously consider them in the Open Source community and the same is true of the Raspberries.

All this proprietary stuff is just fluff IMO, but there may be a wee-bit of validity associated with firmware that controls the RF portions of the SoC and the WiFi/Bluetooth peripherals since most hackers would dearly like to run these chips in higher power modes than might be allowed by local authorities - and such power levels could easily damage the silicon.

I think the question to be asked goes along these lines:
Does an end-user application running on an Open Source OS (Linux, LlineageOS, Android) which rides a proprietary firmware wrapper (API) around the SoC hardware really meets the requirements to be called Open Source? We who have been in the industry know that the original IBM PC BIOS was "closed source" excepting that the HEX could be read from the BIOS and the I/O ROM chips and sent through a disassembler. As a hardware engineer, ROM (flash) firmware is generally considered to be in the hardware domain and is maintained completely separately for revision control; however, higher level API calls may require a minimum of a lower-level firmware version.

The concept of Open Source implies the "Many Eyes Review" which is supposed to prevent (or allow quick remediation) for those nasty hackers that would do something malicious: http://www.androidpolice.com/2017/04/06 ... d-devices/


Ray

User avatar
mrburnette
Posts: 1783
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: New RPi Zero W - with Wifi and Bluetooth

Post by mrburnette » Mon May 15, 2017 4:32 pm

martinayotte wrote:You can also get some OrangePiZero for less than $8.00 including shipping, but no BT.

IMHO (well, as humble as I can get), anyway you shake it, Bluetooth is easily worth $2. Just having a BT connection for a keyboard/mouse is extremely handy and avoids having to have a USB-serial adapter connected to get to the console... useful but not as useful as BT KbM running up on the GUI level.



Ray
Last edited by mrburnette on Tue May 16, 2017 2:49 pm, edited 1 time in total.

User avatar
Rick Kimball
Posts: 862
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: New RPi Zero W - with Wifi and Bluetooth

Post by Rick Kimball » Mon May 15, 2017 5:29 pm

sheepdoll wrote: The founder of the local makerspace Arron Newcomb just wrote a book for Arduino users who want to use Linux on single board computers such as the Raspberry pi.

It is called Make: Linux for makers ISBN 9781680451832
http://shop.oreilly.com/product/0636920031338.do
Nice, if you have a safaribooksonline subscription, it is available there:

https://www.safaribooksonline.com/libra ... 680451825/
-rick

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest