App Notes

Contents[Hide]
Download zip archive

Description

This app lets you use the BumbleBee radar to collect data and then save the data to a file on a PC for later analysis. The overall process is as follows, assuming you have two .NOWs, one set up for collecting and another for exfiltration. Details are given below.

  • Use the BumbleBee Radar Data Collector ("Data Collector") to collect the data. Put a microSD card into the .NOW set up for collecting and start the program. It will collect data until you tell it to stop by pressing a button. The data is stored on the microSD card. The sampling interval is 3906 microseconds, which is about 250 samples per second.

  • You can use the Data Collector Exfiltrator ("Exfiltrator") and the Data Collector Host ("Host") to transfer the data from the microSD card to a PC. 

Compatibility

eMote.NOW 1.0, eMote version 4.3.1.12 and Visual Studio 2012.

About the BumbleBee Radar

The BumbleBee is a pulsed Doppler radar. It has a range of about 10 meters and can be used to detect motion and displacement, and can be used to categorize items within the field (small animal, human, car, and so forth). BumbleBee Radar Layout, Pinouts and Connection Map gives further details. Information about the theory and operation of the BumbleBee is available at Theory and Use of Radar.

Key Ideas

Overall, the app note illustrates how to radar collect data and exfiltrate to a PC. We buffer data using DataStore and, when collection is done, copy it to a microSD card; this because writing to microSD is much slower than DataStore

BumbleBee Radar Data Collector

Collecting the radar data requires realtime performance. The analog-to-digital (ADC) driver populates buffers with samples and signals a call-back when the buffers are full. The call-back handler, ADCCallback, must deal with them before the next call-back. We do this by starting another buffer processing thread (WriteSampleBufferQueue) that waits on a semaphore. ADCCallback copies the buffers, signals WriteSampleBufferQueue, and returns.

  • Collection should continue even if buffer processing takes too long. Sometimes the time it takes for WriteSampleBufferQueue to deal with a particular pair of buffers is longer than the time it takes to collect the next pair. We handle this by setting up a circular queue of buffer pairs. ADCCallback inserts the current pair into the queue and WriteSampleBufferQueue dequeues and processes them. If processing for one pair takes too long but subsequent pairs take sufficiently less time, it can catch up without missing data. If the queue gets full, we declare a bad collect and terminate with an error.
  • Collection should not be disrupted by garbage collection. The eMote garbage collector, GC, runs when free space on the heap runs low. GC, which starts spontaneously, can interrupt any part of the program. We avoid this by ensuring that the free space does not decrease during the collection itself. Primarily, this means that the buffers needed for enqueing are pre-allocated. In addition, if the Visual Studio debugger is not attached, Debug.Print statements (which create and discard strings and therefore reduce free space) are suppressed.
  • Sample storage should be fast enough to keep up with collection. Writing to the microSD card is fairly slow: too slow do in real time. Instead, we collect to DataStore storage and when done, copy from DataStore to the microSD card. The Persistent Object Storage app note also shows how to use DataStore.

Setup

For convenience, we recommend using multiple .NOWs: one for the Data Collector and another for Exfiltrator. If necessary, you can use just one .NOW, deploying the program you need when you need it. The setup details are as follows:

Bumblebee Data Collector

Connect the BumbleBee to the .NOW as follows:

BumbleBee     .NOW
Name Pin   Name Pin
Ground J1 / 1   Ground J12 / 10
Power J1 / 2   VOut J11 / 1
Shutdown J1 / 3   +2v J11 / 2
In Phase (real) J2 / 3   ADC 1 J12 / 8
Quadrature (imaginary) J2 / 5   ADC 2 J12 / 9

Note that the BumbleBee's Shutdown line has 2 volts applied. This means it's  on whenever the .NOW is powered.

Next, connect a momentary contact, single pole, single throw push-button switch to the .NOW as follows:

.NOW
Name Pin
GPIO_J11_PIN5
J11 / 5
Ground J12 / 10

The switch is used to let the Data Collector program know that sampling should stop.

We're using a single source of power. It can be either USB power from a PC or some other USB power source, or a battery pack with of at least 3.65 v. A 3-cell battery pack with nominal 4.5 v works well. For field use, it's convenient to have an on-off switch on the battery pack.

Operation

Install a microSD card into the .NOW. To open the connector, slide it towards the radio antenna (away from the battery connector). It will move about 4 mm. Raise the top of the connector by lifting from the antenna side. It will lift back about 120 degrees, allowing you to insert or remove the microSD card. When inserting, the pins on the card must contact the pins on the board. To close the connector, lay the top back flush with the board and slide away from the antenna (towards the battery connector). Always take care to be gentle as the hinge is easily damaged.

  • Connect power. This can be either USB power or battery power if at least 4 v. 
  • Check for error. If there is a problem accessing the microSD card, you'll see "err" displayed on the .NOW LCD panel.
  • Start collection. When you're ready, press the reset button to restart the program. See .NOW Board Components for the location of the reset button. After a brief start up, the LCD panel will display "cccc". Move out of the sampling field; the BumbleBee has a maximum range of about 10 meters. 
  • When you are finished collecting, press the momentary-contact push button that you attached. This will stop the collection.
    • On the .NOW LCD panel you will see "xxxx" as it processes the final buffers of data that were collected, followed by "tttt" as the data are copied from DataStore to the microSD card. When all is done, you will see "0000" (all zeroes).
    • If you see "err", there was some hardware error and the collection failed.
    • If you see "full", the sample buffer queue filled because processing took too long. Again, the collection failed.
  • Disconnect power. This is optional if you're using USB power. If you're using battery power, turn off the battery or remove the connector to avoid draining the battery when not collecting.

Standards for microSD cards in the industry are loose and not all cards work on all systems. We have found good results with cards made by SanDisk. For ordinary data collection, a 2 GB capactiy is more than enough.

Suggestions

Try integrating the Wireless Data Collector app note with this app so that collected values are sent wirelessly by Data Collector to Exfiltrator and thence directly to Host, bypassing the need to use a microSD card for intermediate storage.