Follow Me On...

Zigbee Smartdust Project

My project is to build network nodes which utilize some sort of mesh network for communication.  Zigbee chips implement this mesh network.  So, i’m intending to use zigbee based products to build the smallest, low power application circuit which will allow multiple nodes to relay information collected from various sensors on each node.  The information will eventually find it’s way to a PC which will be able to monitor the status of all the nodes. 

This project is still in progress.



Project Journal:

Entries by Blake Robertson (14)



Please note!  That there are a few errors in the PCB layout that i found.  I will not have time to continue to work on this project until july, but if you really want an updated board layout before then if you contact me (see link on the left) i’ll update it really quick for you.

Sorry for any inconvenience.



PCB Layout Errors

The following errors were found today during testing:


1) SEPIC regulator library is incorrect.  I must of been looking at the application circuit which shows the pinout for the 6 pin qfn package.  The circuit doesn’t say that the package being used in that diagram is either package explicitly.  Since it shows pin numbers at all it kind of deceiving since most devices with different packages still have the same pinout.

2) Reset switch is always on.  The way it switches is opposite from what the package shows in the board layout. 


I found the errors above because i’m trying to debug what is causing my circuit not to operate properly.  At this point i’ve removed all of the voltage regulator pins and the reset switch.

Problem: When power is applied from the battery, the battery voltage drops from 3.0VDC to ~0.8VDC
Hypothesis: Something is dropping a lot of current causing the battery voltage to sag. 

Analysis steps:

  • Measured Resistance between VCC and GND and it’s 2M Ohms.  Because there is a resistance there when power isn’t applied this rules out the possibility that that VCC and GND are shorted. 
  • When i tested running the circuit off of USB, VCC was about 1.5V and the PIC got really hot.  I only had it plugged in for a second.  But, the fact that i may have damaged the PIC is a possiblity.  But, if the PIC was damaged in a way that was causing a short we’d expect there to be a resistance between ground and VCC.  Additionally, when a chip gets damaged due to too much current running through it, as far as i know it usually damages it in such a way that it becomes an open circuit.  
  • Next, i verified the theory above that when a device is damaged due to too much current that they become open circuits not closed circuits.  For my test i used a general purpose diode which i hooked up to a power supply with 20V across it with no resistor.  Before i tried to damage it the resistance from anode to cathode was 700 Ohms and from cathode to anode it was a lot (didn’t register on meter).  After letting 3A run through the diode for about 20 minutes.
  • I haven’t tried hooking up the USB since i have disconnected the Voltage regulator.  Now that the regulator isn’t hooked up we can test the other possible source of trouble which is the PIC’s VUSB connector.  It appeared that a lot current was still going through the device.  That means with nothing connected to VCC there is still a lot of current getting pumped through it.  So, if there is no connection between the VCC and VinUSB then

1) it must be draining current through the other PIC pins connected to the USB connector  - or -

2) Some connection on the USB cable is hooked up wrong. 

  • After reviewing the PIC Datasheet i found the following info:

“The regulator is enabled by default and can be disabled through the VREGEN configuration bit. When enabled, the voltage is visible on pin VUSB.”

Well… if the regulator is enabled by default then how are you supposed to even program the device to begin with if having an external regulator hooked up to VUSB when the internal tranceiver is enabled is a no no.

Another piece of information that i don’t understand which is probably a hint of the big problem:

“VDD must be greater than VUSB at all times, even with the regulator disabled.

  • Before i search the web to find out why this is a problem i’m just going to desolder VUSB really quick to see if that’s the problem.
  • Removing VUSB did not fix the problem. 
  • Completely removing the regulator also didn’t fix the problem.

At this point lets just review what is hooked up.  Battery -> Switch -> VCC,  VCC-> 2M Ohm -> GND  (2M Ohms of resistance between ground and VCC), Vin from he USB port isn’t connected to anything so the only thing connected at all from the USB connector is D+, D- and GND. 

Areas to checkout

  • Does connecting USB draw a lot of current even with there being no path from Vin USB -> VCC

YES! This means that there could be some issue with the capacitors, or there is some issue with not having pullups on D- and D+. or of course that VDD and VSS are swtiched…

  • PROBLEM FOUND!#$@#$@#$ Apparently the eagle library i used has VDD and VSS switched.  All signs were pointing to this being the problem but, it just seemed very unlikely since i didn’t make the library and they were posted on the internet.



Schematic / Board Layout Complete

The final schematic and board layouts are shown below.  For the .brd and .sch files go to the files section for this project.

[click to expand]                 [click to expand]
  [click to expand]                         [click to expand]






Today i got around to assembling the first board.

Everything appears to be good so far.  I still haven’t powered it up yet but no major snags at this time.  The biggest pain in the assembly i felt were the electroylic capacitors.  The other thing that wasn’t obvious at first was the direction the diodes go in.  It’s hard to tell but if you look very closely you can see a line on the edge of one side indicates that side is the cathode. 



Order Placed

Order was just placed with Advanced Circuits.  The gerber files can be found here.




I made a minor mistake on the sensor daughter card with the mems mic and the temperature sensor.  The temp. sensor VDD and GND connections didn’t get routed to it’s header so in order to use it make sure you just put jumpers between those pins and one of the other VDD and GND pads available on the card.


PCB Design Inspection Notes

Today most of my parts came in from digikey.  After i verify that all the libraries i made for various components like switches were done properly, I’m going to send out the boards to get fabbed.  

Assembly Notes:

SMD LEDS there is a small dot on the side that is the cathode


Battery Choice

I ruled out pretty much all other batteries but lithium coins because they’re so small, cheep, and didn’t want to include a recharger circuit on board. 

So, the choice mainly comes down to using a 12mm, 20mm or 24mm coin.

12.5mm Coins:
CR1220 has a 35mAh capacity and costs $0.95

20mm Coins:
CR2016 has a 90mAh capacity and costs $0.30
CR2032 has a 220mAh capacity and costs $0.30


Battery Low Detect

It would be desirable to have an indicator on board to let the user know when the battery is low.  Typically, to monitor the battery voltage you can run a wire from V+ of your battery to an analog input pin on your uC. 

In this circuit however, there are two operating modes.
1) Running off of Vusb which results in a system Vdd of 3.3V
2) Running off the Vbatt which results in a system Vdd of 2.7V-3V

The digital value for a corresponding Analog voltage for an n bit A/D converter is:
(Vanalog * 2^n) / (Vrange) == ( Vanalog * 2^n) /  (Vref+ - Vref-)

Where Vref+ is typically Vdd and Vref- is usually ground.  So, when you’re running off of the battery you will have Vanalog = Vref+ which results in Vanalog*2^n / Vanalog == 2^n * (1) = 2^n

What that means is regardless of what the actual battery voltage is the digital value will always be 2^n.

So, i devised a circuit which takes advantage of the built in potential of a diode. How it works is the voltage the A/D converter will always be evaluating is 0.7V. But, as the Vdd decreases (due to the battery loosing charge) since the Vref+ == Vdd the voltage range the analog to digital converter has to cover will reduce.



For the following example the following assumptions are made: 

1.  Vref+ = Vbatt = Vdd
2.  Vref- = GND 
3.  n = 10  (10 bit A/D)

If Vbatt = 3.3V:
0.7V*2^10 / (3.0V-0) = 217

If Vbatt = 3.0V:
0.7V*2^10 / (3.0V-0) = 238

If Vbatt = 2.7V:
0.7V*2^10 / (2.7V-0) = 265

If Vbatt = 2.5V:
0.7V*2^10 / (2.5-0) = 286

As you can see the lower the battery voltage gets the higher the digital value.  The code running on the microcontroller should read the battery voltage on RA0 and if it’s greater then a certain threshold value then we say that the battery is low.  Since lithium batteries have a in system voltage of about 2.7V but have a very flat discharge curve.  I will probably set my threshold value to be somewhere around 275 which is in-between 2.7V and 2.5V.  Threshold values are usually determined experimentally but our hand calculations provide us with a good starting point.

There is one small problem with this circuit.  When the unit is attached to a computer via a usb cable then the system Vdd voltage is 3.3V.  Which means that Vref+ = 3.3V and no longer will it equal Vbatt.  Therefore, we no longer have anyway to detect whether or not we have a low battery when the unit is plugged into the usb port.  To remedy this we would have to dedicate another analog i/o pin and connect it directly to the positive terminal of the battery. 

There are two other ways this could be fixed.  One way would be to use a buck regulator to boost the battery voltage to 3.3V which i decided not to do to reduce parts, complexity, and reduced noise in the circuit.  The other way would be to tie Vref+ to Vbatt+.  That way our little trick would always work.  But, then any users that were planning on using the A/D converter wouldn’t have a constant voltage reference which would make their data dependent on battery voltage which isn’t good.  

This isn’t that important since when the battery condition is most important is when we are powering it from the battery.  So, when Vusb is detected we will not update the battery low pin. 


PIC uC I/O Pin Notes

The Microchip Zigbee stack uses some i/o pins that are used for the USB functions on the PIC18f4550.   I also had to figure out which pins were used for ICSP.  Below are some notes that i found interesting about the I/O Ports.

PORTC is primarily multiplexed with serial communications
modules, including the EUSART, MSSP module
and the USB module (Table 10-5). Except for RC4 and
RC5, PORTC uses Schmitt Trigger input buffers.

SDO = SPI Data Output
RX = Asynchronous serial receive data input
TX = Asynchronous serial transmit data output.
CK = Synchronous Serial clock output

To determine:
What’s a Schmitt Trigger Input Buffer?


Progress Update

Today i started creating the schematic in Eagle.  I placed an sample order from Microchip to get some PIC16F4550. 

Parts i’m currently looking for:
- A voltage regulator which will boost the output of a 3V lithium coin to 3.3V and will automatically disable if the device is connected to the computer via USB.  If connected to USB then the computer will supply the 3.3V.  Thefore, the voltage regulator should ideally have an active low enable pin. 



Potential part list that i created as i’ve gone through zigbee related datasheets and digikey catalogs that i may or may not use for my board:


  • small USB connector like the one on digital cameras - Digikey Part: H295CT-ND
    also see page 44 in catalog for another connector with the mating cable,

    Walcom connector: WM5974-ND (datasheet) & the cable- WM5975-ND

  • 3.3V low drop-out regulator: LP2981AIM5-3.3, National Semiconductor
  • 1.8V low drop out regulator: LP3961ES-1.8, National Semiconductor
  • Connector to put on my board to connect with the 2420EB is SMD_HEADER_2x10 (Samtec TFM-110-02-S-D-A-K-TR) - footprint to make library later
  • Connector on the 2420EB is Samtec SMD_SOCKET_2x10 (Samtec SFM-110-02-S-D-A-K-TR)
  • Microcontroller: PIC18LF4620

Project Costs - To Be Determined

Assuming i can’t get any of the Microchip PICDEM modules in time and i want to make the zigbee application boards as small as possible it appears i have two possible avenues.

1) Using the compx module’s which will cost $199 per board i produce and assuming i want to produce at least 3 then the project costs for the rf section is going to be around $600.

2) Build the RF section onto my board and then have a contract manufacturer such as flexone or screaming circuits professionally assemble my boards.  The assembly costs will probably run close to $500 to get 5 boards produced.  The resulting project board would be smaller but their is added risk if there is any error in my layout.  The performance probably will not be as good especially if i only do a 2 layer board which i’m used to doing.  Also, the development time would be increased.

I’m emailed compX asking about their costs and availability.  After hearing back from them i’ll make a decision. 


Evaluating various RF Cards

The goal of my completed circuit is to be as small as possible.  So, ideally i would all the chips on one PCB.  But, since the package size on the RF transiever chips is so small, i don’t have the suitable equipment available to me in the lab to solder them.  Thus, i’m going to have to use a preassembled module.  This entry is a summary of the different RF modules that are available at the time (4-17-05).

Option 1:  PICDEM Z 2.4 GHz RF Card (part # AC163027-2) from Microchip

RF Chip: Chipcon’s CC2420 2.4Ghz RF Transceiver
Cost: $39-$49
Availability (from microchip): ship-by 30-may-2005 from microchip
Availability (from Digikey): not in stock
Approximate Dimensions: 1.8” x 1.8” (estimate using the .1” pitch headers as reference)
Antennae: PCB Antenna + option for SMA
Datasheet: Click Here and goto page 36

Conclusion: I like how this board has the PCB antenna which is a requirement, only problem is it’s currently not available.

Option 2: Chipcon CC2420EMK

RF Chip: Chipcon CC2420
Cost: $70.00 (2 for 140.00 from mouser)
Availability: in stock at mouser
Datasheet: Click Here - see page 3
Dimensions: Approx 2.75” x 2.10”
Additional Links: All Development Kit Files - user manual, etc.
Conclusion: This board is available but it’s more expensive then microchip’s and it doesn’t have a PCB antenna and attaching an SMA antenna will make my overall module pretty bulky.

Option 3: Freescale 13192 RF Daughter Card

RF Chip: MC13192
PCB Antenna: NO - two sma connectors only.


At this point I found another person’s blog which had considerable information about currently available zigbee stuff.


Option 4: CompXS Outerside Module

RF Chip: CX1540
PCB Antenna: YES - includes a ceramic antenna
Cost: $199 each!
Size: Half-Credit card sized… they have a mini version which is 12mm x 12mm
Availability: appears to be
User Manual: Click Here

Conclusion: This module is perfect except for it’s price.  But, it may be the only solution available if i wanna complete this project before the end of May.