UBW32 (32 bit PIC32 based
USB Bit Whacker)
An inexpensive, simple input/output device to
connect your computer to the real world.
With many pins and more horsepower. (At least compared to
the original 8-bit UBW.)
By: Brian Schmalz
The UBW32 is a small board that you can plug into your computer
(running Windows, MacOS or Linux) via USB. The USB connection can
power the board and allows you to send it commands from the
computer. These commands allow you to interface your computer to the
real world - like controlling things and getting input from things.
The UBW32 can plug into a standard breadboard in several different
ways, or you can wire directly to it. You can power it through the
USB connection or from an external voltage source. It has 3 push
buttons (Reset, and 2 user-defined buttons) and 5 LEDs (Power, USB,
and 3 user defined LEDs). It breaks out all of the PIC32's I/O pins
to pins around the outside of the board. The firmware that comes
with the UBW32 understands very simple commands that you can type to
it in a terminal emulator. These commands allow it to do some
powerful things, and allow your computer to do even more (when you
write an application on your computer to talk to the UBW32). The
UBW32 has 32KBytes of RAM and 512KBytes of Flash. It has 78 usable
I/O pins, many of which can be used as analog inputs. The CPU runs
at 80MHz and has significant hardware peripherals. The UBW32 works
with 3.3V I/O, but all digital-only pins are 5V tolerant (as inputs)
(note that some pins that look like they're digital-only actually
have some analog functionality - like RC13 and RC14 which can
connect to a secondary crystal). The UBW32 uses the PIC32MX795F512L 32-bit CPU from Microchip.
And you can even buy a UBW32 directly from
SparkFun.com for $40! And they even sell it with a
PIC32MX795F512L now. (03/06/2011)
UBW32 Hardware Features:
(updated 03/06/2011 for new UBW32 MX795 version - note, all firmware
versions work identically on both MX460 and MX795 UBW32s )
- 78 usable I/O pins - all header holes on .100" grid
- 73 usable I/O pins available along edges, allow for easy "DIP"
style breadboard mounting
- miniUSB connection - supplies power and full speed USB
connection to PC (Mini-B connector soldered on the top of the
- 3.3V power regulator
- 5V power regulator allows higher voltage (battery or other)
- Power Select switch allows selecting between USB and external
power (acts as power-on switch)
- Ground, 3.3V and 5V pins available on both sides for vertical
- 5 LEDS - 1 for power, 4 under software control
- 3 push buttons - 1 for reset, 2 for software use
- .100" Header and footprint (on bottom of board) for USB Host
connector (A type) - with the right software, allows for USB
- Minimal board size - very thin (.28" high, 4.4" long, 1" wide)
and 2 mounting holes
- Uses PIC32MX795 processor - 80MHz, 512K Flash, 128K RAM, MIPS
based CPU core (free development tools from Microchip)
- Input protection fuse allows 500mA from the power supply
- External input power protected by diode
UBW32 Software Features:
If you have used a UBW
or Arduino before and are
frustrated by the lack of CPU power, lack of memory, lack of I/O
pins, or lack of sophisticated software, the UBW32 may be just what
you are looking for. While costing only slightly more than an 8-bit
UBW, (and less than
some Arduinos) it has significantly more power, particularly in
terms of CPU horsepower.
- HID based bootloader allows for updating firmware without a
hardware programmer - burn new firmware using only your PC (Mac,
Windows or Linux)
- UBW32 Firmware supports controlling every digital I/O pin
using USB serial port (see documentation list below for exact
- Bootloader and UBW32 Firmware software projects available
below as examples for you to write your own code - make the
UBW32 do anything you want!
The UBW32 is also a stand-alone development platform for the USB PIC32 chip. It contains
a simple to use USB bootloader so that you can write your own code
and download it to the board without any additional tools or
software. You can write your own code to do whatever you want.
(Just like an Arduino or any other development board.)
If you want to use a hardware debugger or programmer with the UBW32,
you can easily connect to the UBW32 using the standard 5 ICSP pins.
They are located along the upper left edge of the UBW32. I use a PICKit2 (for the MX460) and
PICKit3 (for the MX795) for UBW32 development. A PICKit2 or PICKit3
can plug directly into the ICSP pins on the UBW32 with a simple
5-pin header. You can also use PICKit3, ICD2, ICD3 or RealIce to
program/debug if you want. This is all optional and not necessary
unless you need to do hardware debugging of your code.
The PIC32 chip is capable of doing USB OTG, USB Function and USB
Host roles. There is a footprint on the bottom of the board for a
USB connector that will allow you to plug any USB device into the
UBW32. There is a jumper that allows you to power the VBUS 5V USB
wire if you program your UBW32 to be a USB Host.
- (2014/08/11) A new version (v1.6.4) is released, with much
better Software PWM documentation and a bug in that command
fixed. See UBW32
Firmware v1.6.4 Documentation for more details.
- (2013/03/11) Thanks to Jim Buszkiewicz, we found that the
UBW32 HID Bootloader project does NOT fit properly if an MLA
after or including 2012-04-03 is used. See bootloader project
below for more information.
- (2012/01/21) A nice little generic
USB demo project for the UBW32.
- (2011/12/04) Both HelloWorld and HelloUSBWorld projects (see
Firmware Versions below) have been updated to contain MPLAB X
and MPLAB 8 projects.
- (2011/11/30) UBW32
firmware v1.6.3 (zip) (no code changes) updated: now has
MPLAB X and MPLAB 8 projects, and compiles with C32 v2.01 as
well as MAL USB v2.9b stack.
- (2011/11/22) An updated HID
Bootloader project (zip) is now available. No code
changes, but this is now a combined MPLAB 8 and MPLAB X project
which compiles with the latest C32 v2.01 compiler and latest USB
stack from Microchip.
- (2011/11/13) The Beyond
Arduino blog is doing some great articles on UBW32. Check
- (2011/09/24) Another
Hello World project for UBW32 - Thanks Solarwind!
- (2011/09/05) UBW32 firmware v1.6.3 released - Merged code from
Andrew Prudil that adds analog input commands (CA and IA). See v1.6.3 documentation
- (2011/09/02) UBW32 firmware v1.6.2 released - main change is
that it now requires C32 v2.00 or above to compile. Tested with
MPLAB 8.76 and USB stack v2.9a. See below for files.
- (2011/09/02 HelloWorld and HelloUSBWorld projects both tested
(and work) with C32 v2.01, MPLAB 8.76, USB stack v2.9a. Project
- (2011/05/16) Cadet
Adam Schinder was kind enough to allow us to share his
To Compile Projects for the UBW32" - if you're having
trouble figuring out how to build the example projects, or
your own fimrware for the UBW32, his doc may help you out.
- (2011/03/06) SparkFun is now selling the new UBW32 boards,
which have the MX795 processor and space for a 32KHz crystal
- (2011/01/010) Stephen Semmelroth has been creating videos
illustrating some basic UBW32 concepts. Check them out: HelloWorld
are just two.
- (2011/01/10) SparkFun should (soon) have a PIC32MX795 based
UBW32 for sale.
- (2010/11/01) Added UBW32 Firmware v1.4 (see below under
- (2010/10/13) Added an Egale footprint of
entire UBW32 board (thanks Cid Vilas for doing almost all the
- (2010/08/29) Added hardware version v25 and v26 documenation
to website. SparkFun has been shipping v25 for quite some time
and I've forgotten to put up the files.V26 is going into
production very shortly and will be available soon. (New
hardware features include a real 8MHz crystal vs. an RC
oscillator and pads for a 32KHz watch crystal for the RTC
- (2010/08/29) Updated UBW32 Firmware, HID Bootloader,
HelloWorld and HelloUSBWorld project to use latest unmodified
Microchip USB stack folder from Microchip. All now compile with
latest build tools (MPLAB, C32 and Microchip Application
Library) from Microchip. See Firmware Build
Instructions for more information on setting up build
tools to build these projects.
- (2010/08/29) Worried about merging HEX files easily and
cleanly (like the bootloader and your favorite firmware) into
one HEX file to program into UBW32 using a hardware programmer?
Well worry no more- Microchip has been kind enough to give me
permission to re-distribute their HEXMATE.exe utility
application (from Hi-Tech). I've written up a nice little page
- (2010/04/26) A new FAQ page
has appeared. Much will be added to it over time.
- (2009/11/01) As of (about) today, SparkFun will be shipping
UBW32s with this
combined HEX file - the latest bootloader (that fixes the
problem with the BL command as noted below) and UBW32 Firmware
- (2009/11/01) Added HID Bootloader
- (2009/11/01) Incompatibiliy between UBW32 firmware v1.3 and
origional bootloader found - BL command breaks. Use firmware 1.2
or latest bootloader to allow BL command to work. Thanks Jan for
finding this problem.
- (2009/09/14) Updated to UBW32 firmware,
version 1.3 posted. Several changes necessary to support
latest USB stack v2.5b from Microchip.
- (2009/09/07) Updated to UBW32 firmware,
version 1.2 posted. Only change is fixing location of
SoftwareKey variable so that BL command becomes reliable.
- (2009/08/26) Updated HIDBoot project (see below) - updated the
old HIDBoot bootloader code to use the latest Microchip USB
stack v2.5a. All features of the bootloader still function. You
will need a hardware programmer (PICKit2, etc.) to use this new
bootloader. There are NO functional differences that I can tell
- if you're OK with the bootloader you've got, don't update.
- (2009/02/16) New UBW32
version 1.1 posted. No new features, just bug fixes to C,
PI, PO and PD commands.
- (2009/02/13) WOW! Check this out - a totally self-contained
development system that runs on PIC32 called the StickOS. I get an
e-mail out of the blue from Rich Testardi where he asks me to
see if his software will run unmodified on the UBW32. Guess
what! It DOES! You can find the HEX file for the UBW32 version
of StickOS on
this page. This software is just the slickest thing -
interactive debugging, BASIC, save files to Flash, profiling,
timers, interrupts, and massive amounts of awesomeness. And all
over a serial port! Make sure to use the UBW32 HEX file, as it
is built to work with our bootloader. You can
download the StickOS HEX file just like a normal UBW32 firmware
HEX file. Definitely check out StickOS. It also includes ZigBee
support. We'll need to add that to the next UBW32 version. :-)
- (2009/01/31) I've now edited the nice projects that Alex Lee
sent me so that they are location independent and compile (and
work!) for UBW, UBW32 and Microchip's FSUSB demo board. See
below for new set of files.
- (2009/01/23) Alex Lee has ported the Jan Axelson Generic HID
demo to the UBW and UBW32! Here
is the zip file for the project. In order to make it work,
you need to replace ./microchip/Include/USB/usb_function_hid.h
Device Driver/usb_function_hid.c as well. Thanks so much
- (2009/1/18) Added a very simple HelloUSBWorld
project - shows how to receive and send USB data with
- (2008/12/10) Added very simple HelloWorld
project - shows super simple LED output, switch input, and
timing using ISR.
- (2008/12/04) Added a 'guide' and release notes page for v24
- (2008/12/02) I will be adding more commands to the UBW32
firmware starting in January. Send me e-mail if you have
suggestions for what you'd like me to work on.
- (2008/12/01) SparkFun has just announced that the UBW32
is now available for sale at $40.
- (2008/11/18) Added a YouTube
video of the "T1" command - lights up all I/O pins in
turn, shows off basic UBW32 functionality
- (2008/11/17) Added basic documentation for UBW32 Firmware 1.0
- (2008/11/12) I've sent the combined HID Bootloader and UBW32
firmware v1.0 HEX file to SparkFun for use in producing the
first batch of boards.
- (2008/11/11) I think the first version of firmware is ready.
SparkFun has been working on bringing the v2.4 boards into
production and soon UBW32s will be for sale at their site.
|UBW32 Hardware Versions Matrix
|Eagle Files and BOM (zip)
|v2.4 - First production version
|v2.5 - Fixed silk screen for port E
|v2.6 - New crystal, 32KHz footprint
Firmware Versions (Source code and
project files - browsable):
Note: All firmware versions work identically on both MX460 and
MX795 based UBW32 boards.
- Firmware v1.0 project files
(depreciated) (HEX, ZIP) (initial release,
contains digital I/O commands only)
- Firmware v1.1 project files
(depreciated) (HEX, ZIP) Minor bug fix to
- Firmware v1.2 project files
(depreciated) (HEX, ZIP) Fixed problem
with location of SoftwareKey variable for BL command.
- Firmware v1.3 project files
(depreciated) (HEX, ZIP) Updated project
to use MicrochipUSB stack v2.7
- Firmware v1.4 project files
(depreciated) (HEX, ZIP) Added test
commands - and builds properly with Microchip USB Stack v2.7
- Firmware v1.6.2 project files (HEX, ZIP) Builds with
C32 v2.01, MPLAB 8.76, USB stack v2.9a. Also added support for
32bit ints and floats in extract_numer(). Also added new PWM
output commands PM and SP.
- Firmware v1.6.3 project files
(HEX, ZIP) Added in
analog input commands CA and IA. Updated with MPLAB 8.80 and
MPLAB X projects, compiled with C32 v2.01 and MAL USB 2.9b
- Firmware v1.6.4 project files
Updated docs and fixed bug in Software PWM command.
- HelloWorld project files (HEX, ZIP) - shows
simple code (no USB) running on UBW32. Blinks an LED at
different rates based upon button push.
- HelloUSBWorld project files (HEX, ZIP) - shows
simple USB sending and receiving running on USB32.
Software projects other people have written for UBW32 hardware:
- Generic HID demo from USB v2.3.1 stack, ported by Alex Lee
(Original files from Alex)
- Generic HID demo, ported by Alex Lee and modified by Brian
Schmalz. This version is location independent - as long as the
Microchip directory (with the UBW v2.8 stack is at the same
level as the project folder - FW_HID_BPS) then it will work
fine. There are no hard coded paths in any of the projects. Also
I built and tested all three targets (UBW, UBW32 and FSUSB demo
board) and they all work great. I've renamed the projects as
well so as to be very clear which one is which.
- UBW32 HID Bootloader project files
MX460 CPUs, HEX-For
MX795 CPUs, complete project ZIP) (updated on
11/22/11 with MPLAB 8 and MPLAB X projects, building with C32
v2.01 and MAL USB 2.9a) Note that if you choose to re-compile
the bootloader, it must fit in 0x0000-0x4FFF. In order to get
this to work, you have to use an MLA (Microchip Library for
Applications) version PRIOR to the 2012-04-03 version. If you
use that version or later, the USB stack is too big and it will
not fit below 0x4FFF and will fail to program your applications
properly. Please get the older versions here.
- UBW32 Driver Files : Contains
the INF file that will work under Windows 2K, XP, Vista and Win7
USB Framework Files:
(Grab the first three in
order to build code for the UBW32)
- Microchip MPLAB
(Microchip's free IDE for editing, compiling, debugging code)
- Microchip C32
compiler (for building bootloader and firmware - I used student
edition which is free)
- Microchip Application
Library (MAL) Download this entire thing to get all of the
latest USB stack and example code projects from Microchip
- Microchip's USB pages
(including information on the USB PICs as well as app notes and
firmware examples - all UBW32 code is based on their USB
- Liberty Basic (for
the PC side of things - what an awesome language - I used free
- Eagle (for editing the
schematic and board layouts - the free version will allow you to
load and edit the files)
- BatchPCB (where to get
higher quality boards made - this is a sister company to
PIC32 documentation (datasheet) (read and re-read this if
you want to write your own firmware)
- UBW32 Driver Files : Contains the
INF file that will work under Windows 2K, XP, Vista and Win7
Questions? E-mail me at