Close
0%
0%

pi2wifi

$5 WiFi for the Pi Zero without using USB

Similar projects worth following
Remix of the awesome RPi WiFi project, optimized for low cost. (With the release of the Pi Zero W, this project isn't so useful anymore. Unless you're building a multi-radio mesh node!)

Cost is $5 each only if you build three. If you build one, it costs more like $9. But you really need three if you think about it, right?

NOTE: REDESIGN IN PROGRESS SO THIS WILL BE COMPATIBLE WITH THE PI ZERO W. CHECK BACK LATER.

First, I want to give well-earned credit to this wonderful project. (Read through it, it's very informative.) I'm truly standing on the shoulders of giants here: all I've done is make it as small as possible, leveraging my technique of using resistors to attach a circuit board to the Pi Zero like I did here. I guess it's kind of a reductionist thing. The result is a somewhat slow WiFi adapter for the Pi Zero for under $5.

Here's the schematic. The connection from test point P1-EN to the ESP module EN pin isn't shown. Also not shown are 33 ohm series resistors between P2 and the Pi Zero, on all but P2-17, 30, and 34, which are directly connected. Pretty simple isn't it?

DOING THE WORK

I spent an afternoon designing the board, and sent it off to OSH Park. I was somewhat anxious: I'd never done a cutout before, and the cutout had to be made oversize since it had rounded edges. I also had to make a footprint for the ESP, so I didn't know if it was accurate. I didn't know if my power and ground traces were large enough. I was worried about cross-talk in the data lines since there wasn't enought room for a ground plane. And I'd never lap-soldered a module before: could I make the necessary low-resistance connections by hand? So many worries.

As for software, the original kernel module source only needed some small changes. I changed the reset GPIO since I didn't want to fiddle with module parameters. I added a few lines of code to both the source and the overlay so the overlay would auto-load the module. I changed a couple of makefiles so the module would compile in-tree. After a quick compile, I had a shiny new kernel module!

IT'S SO SIMPLE IT CAN'T FAIL, RIGHT?

While I was waiting for my boards, I built a prototype by soldering short resistors from the ESP to a salvaged IDE connector like this:

I triple checked everything, installed the config files, booted up, and loaded the kernel module. Woo, no smoke! But it didn't actually work. Kernel messages stated that the ESP wasn't resetting. After looking at the source code, it became apparent that it was assumed that the reset line had a pull-up. To do a reset, the code simply set the GPIO as an output with value 0, waited a bit, then freed the GPIO, relying on the pull-up to bring the pin to a logic 1. Of course the GPIO I had selected for reset had a default pull-down. I fixed this by changing the overlay to enable a pull-up on the reset GPIO, compiled the overlay and rebooted.

It was still dead as a doornail. (What is a doornail, anyway?) It was time for the mighty oscilloscope, so I hauled it out and connected it up. I checked the SDIO clock: it seemed to be working. While probing the SDIO data lines, one of the resistors came loose from the ESP because of the probe strain. Then I noticed that one of the other resistors had also come loose: I had cold solder joints! This hadn't happened to me for a long time, so I wasn't expecting it. It was probably caused by the pads on the end of the ESP being so small: they're only designed for lap soldering, not wires. I re-soldered the end connections with plenty of flux and solder, and re-booted.

And it worked! The kernel module loaded, and I could do an iwlist scan. It even picked up my settings from the previously installed USB WiFi dongle, and connected to my access point.

When I received the circuit boards I de-soldered the module from the connector and soldered it to the circuit board. It fit extremely well: the cutout and footprint were perfect. On power-up everything worked flawlessly. I had worried for naught!

Here's what it looked like. The assembly is barely bigger than the Zero:

This edge view shows how thin the assembly is:

BENCHMARKING

It was time for a speed test! I compiled the netio tool, set up a server, and did a test. I was getting better than 3 megabits per second. I tested a USB dongle in another Pi, at the same location, and I got just over 10...

Read more »

esp8089.ko

Kernel module for kernel version 4.4.48+

ko - 279.62 kB - 03/04/2017 at 01:05

Download

esp8089-overlay.dts

overlay source

DTS Audio - 1016.00 bytes - 12/29/2016 at 19:50

Download

esp8089.dtbo

overlay, place in /boot/overlays

dtbo - 1.96 kB - 12/29/2016 at 19:50

Download

config.txt

Pi config file

plain - 1.66 kB - 08/03/2016 at 04:03

Download

pi2wifi.lib

KiCAD library

lib - 1.97 kB - 08/03/2016 at 01:36

Download

View all 15 files

  • 1 × Circuit board from OSH Park, one order will get you three boards. https://oshpark.com/shared_projects/xtETVaDP
  • 7 × 33 ohm 1/8W resistors, for example DigiKey.com part CF18JT33R0CT-ND
  • 3 × 24 gauge solid wire, 25 mm. I find the floors of comms closets are a good source!
  • 1 × 40mm piece of small diameter insulated wire, 30 gauge wire wrap wire is perfect.
  • 1 × ESP-12F module, for example Banggood.com part 1007260

View all 10 components

  • uploaded module for 4.4.48+

    mincepi03/04/2017 at 01:14 4 comments

    I uploaded a kernel module for kernel version 4.4.48+, which corresponds to 2017-02-16 raspbian.

    On another note, with the release of the Pi Zero W, this project is obsolete.

    Or is it really? After thinking about it, I realized it could still be useful for a multi-radio mesh node. So, I'll make some modifications so it will work better in that role.

    The only thing I'll have to do is redesign the PCB. Basically I'll flip the ESP module over, and let it hang over the GPIO edge of the Zero a bit. It'll make the assembly a little bit larger, but improve signal strength greatly, both for the ESP radio and the one built into the Zero W.

    Using this, and a USB WiFi adapter, you could build a three-radio mesh node without using a USB hub!

  • kernel module update

    mincepi12/29/2016 at 19:54 0 comments

    Updated kernel module and overlays. It now works on Raspbian 2016-11-25.

  • initial posting

    mincepi08/03/2016 at 01:03 0 comments

    Initial (and hopefully) final posting.

View all 3 project logs

  • 1

    ASSEMBLY

    • Break any remaining tabs off of the circuit board. Sand the broken edges smooth if you're a perfectionist (like me).
    • Lay the ESP-12F face down on the circuit board, align the traces, and solder it down. Use flux if you have it.
    • Strip the ends and solder the insulated wire from the EN pin on the ESP module to the pad right below the gear symbol on the circuit board.
    • Trim the resistor lead lengths to 20-25mm.
    • Lay a Pi Zero on the foam, component side up.
    • Stab resistors through the Zero all the way into the foam, in GPIO holes 13, 15, 16, 18, 22, 35, and 37.
    • Tease the free ends of the resistors into the proper holes in the circuit board and push the board all the way down until it sits on top of the resistors.
    • Use hot glue or whatever to prop up the ESP end of the board and hold it in place while soldering.
    • Stab the solid wire pieces into the remaining three holes and into the foam, until they only protrude a bit above the circuit board.
    • Solder the resistors and wires to the circuit board and trim the ends.
    • Pull the assembly out of the foam, solder the resistors and wires to the Pi, and trim the ends.
    • Remove the glue or whatever you used. If you used hot glue, the bond can be easily broken by applying Isopropyl Alcohol.
    • Clean up any flux residue.


    QUICK SOFTWARE SETUP

    • Download the 2016-5-27 Raspbian image and copy it to a fresh SD card.
    • Download from the files section esp8089.ko, config.txt, and esp8089.dtbo, and copy them to the SD card's FAT32 partition.
    • Boot the imaged SD card in the Pi and do the usual initial configuration.
    • Reboot and log in.
    • Move /boot/esp8089.dtbo to /boot/overlays.
    • Move /boot/esp8089.ko to /lib/modules/4.4.11+.
    • Run the command sudo depmod.
    • Reboot and the WiFi adapter should work! Of course you need to configure which access point to use, and a password if needed.


    HARDER SOFTWARE SETUP (FOR EXPERTS)

    • Compile the kernel module for the kernel you're running. The source is in the esp8089.tgz file.
    • Copy the compiled kernel module to the proper modules directory and run depmod.
    • Copy the esp8089.dtbo file to /boot/overlays.
    • Add dtoverlay=esp8089,poll_once=off to the /boot/config.txt file.
    • Reboot.

View all instructions

Enjoy this project?

Share

Discussions

Arsenijs wrote a day ago point

Heyy so I put your boards on panels I was ordering from DirtyPCBs, and this is what I got now: 


I think I have about 10, will keep 5 to myself, but to others who like this project - will ship those to Europe/Russia for the (likely, very low) price of sending a flat envelope, since I have so many I'm unlikely to actually use them all in my lifetime =)

  Are you sure? yes | no

Arsenijs wrote a day ago point

Also, @mincepi, if you were to add these to #Small PCBs for panelizing + tutorial project, that'd be just uber cool =) 

  Are you sure? yes | no

ajlitt wrote 08/03/2016 at 21:31 point

Great job!  Looking forward to seeing where you take this one

  Are you sure? yes | no

zakqwy wrote 08/03/2016 at 15:07 point

Love the cordwood resistors!

  Are you sure? yes | no

mincepi wrote 08/03/2016 at 19:32 point

Now that's a description I may have to use in the future!

  Are you sure? yes | no

samern wrote 08/03/2016 at 14:42 point

3?  Heck no more like 10.  Does this baby adapt to the regular Pi2?

  Are you sure? yes | no

mincepi wrote 08/03/2016 at 19:28 point

You have to solder it to a connector. But it should work. Probably better since the antenna is lifted above the Pi. A kernel module would also have to be compiled, since the one in the files area is specific to the Zero/A+/B+.

  Are you sure? yes | no

samern wrote 08/03/2016 at 23:22 point

6 boards ordered....3 Pi Zeros and my A+ will get these!  The remaining 2 boards might go to my B+s.  Awesome.

  Are you sure? yes | no

K.C. Lee wrote 08/03/2016 at 11:22 point

You would want the antenna to overhang the Pi to get better signal.  Having metal connector / PCB under that area detunes the antenna.

http://www.csr.com/introduction-antennas-and-propagation-part-4

>It is quite prone to being pulled off-tune when put close to conductors and dielectrics and will require further matching.

>All of the electronics should be contained within the groundplane area, nothing being placed within the 27mm x 9mm area that contains the inverted-F structure.

  Are you sure? yes | no

mincepi wrote 08/03/2016 at 19:31 point

I knew about the antenna issue going in, but I wanted a small system size and low PCB cost. I was quite surprised it works as well as it does. As I mentioned in the write-up, hanging the ESP off the other edge of the PCB would work better, but a board redesign would be necessary. Or just lift the board off the Zero using longer resistor leads. Or even make it perpendicular to the Zero.

  Are you sure? yes | no

davedarko wrote 08/03/2016 at 10:26 point

That is a great design!

  Are you sure? yes | no

mincepi wrote 08/03/2016 at 19:32 point

Thanks!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates