Hardware – Instrument Transmitter

The ultrasonic anemometer is powered by an external DC power supply from 12 to 30 volts.The Bluetooth interface requires a 5VDC power supply.A circuit board was built with a 5VDC regulator to utilize the same power supply as the anemometer.Two other circuits are required on the instrument side, a RS232 voltage level shifter, and the Bluetooth RF module.Bluetooth modules have different output levels for specific applications, a Class-1 module was chosen for this project for maximum distance (20m-30m).The circuit board for the instrument transmitter is shown in figure 1.

The Bluetooth module was designed by SparkFun electronics (WRL-12580) as a simple streaming modem, and is capable of baud rates up to 115200bps. The inputs to the module are TTL Rx, Tx, and 3.3 to 6 VDC.The module can be programmed for master or slave operation, and can be bound to a specific module, or can pair to the first device it finds.The RS232 level shifter for this project is also from SparkFun electronics (PRT-08780) and interfaces the Bluetooth module TTL Rx and Tx pins to the RS232 level pins of the instrument.The schematic for the instrument side wiring is shown in figure 2.

The physical connections to the R.M. Young 81000 anemometer are shown in figure 3.Pins used are +PWR (12VDC), PWR REF(GND), Tx-O, RX-I, and SREF(GND).


Hardware – Bluetooth DataLogger

The datalogger circuit was built by combining four off-the-shelf modules.The first is an Arduino ® Micro prototyping board designed around the Atmel ATmega32u416MHz processor.A real-time clock (RTC) module from SparkFun (BOB-12708) is connected to the Arduino via a two wire I²C interface. This module is required to add a timestamp to the data stream.The data is received by another Bluetooth module (WRL-12580) and the combined time information and anemometer data is written to a micro-SD memory card using another SparkFun product called OpenLog (DEV-09530).OpenLog is a small PCB that combines a SD card reader with an AtmelATmega328 processor,and uses an open source software library available through the GitHub repository.The datalogger is programmable using the Arduino ® PC software, and the PCB can be powered by battery or a small (500ma) 5 VDC power supply.The datalogger is shown in figure 4.

The four modules are connected using a standard prototyping pcb and a few jumpers to allow in-circuit programming of the Bluetooth module and the OpenLog module with a serial port TTL adapter and a standard PC terminal program such as Hyperterminal or TeraTerm.Figure 5 shows a block schematic of the module wiring.The 5 VDC power to all the modules comes from the micro-USB connector on the Arduino board.An externalpower supply can power the datalogger from this port also.


Software – Bluetooth Module Programming

To save time and keep the Arduino program simple, the programming for the modules are done off-line before powering the system.The parameters for the Bluetooth module are as follows:

***Settings***

BTA=00066669aaaa

BTName=RNBT-aaaa

Baudrt=38.4

Mode=Pair

Authen=0

PinCod=1234

Bonded=1

Rem=00066669bbbb

In this mode, the Bluetooth module will automatically look for device 00066669bbbb and pair with it after powering up.

Software – RTC Module Programming

The real time clock module only needs to be set once when the lithium coin cell battery is first inserted.A line in the Arduino code is added to set the clock, then it is commented out and reloaded.The following is the line of code required to adjust the time to 17 April 2015 at 11:20am:

Rtc.adjust(DateTime(2015, 4, 17, 11, 20, 0));

The RTC module keeps time in seconds only, so the Arduino software must add the milliseconds to the timestamp before sending the data to the SD card.

Software – OpenLog Module Programming

The software for the OpenLog module did not need to be changed for this project.The configuration settings are written to a file on the SD card when a new formatted card is inserted in its socket.The standard configuration file is very short and consists of the following two lines:

38400,26,3,0,0,0,0

baud,escape,esc#,mode,verb,echo,ignoreRX

Software – Arduino Micro Programming

#include 
#include "RTClib.h"
RTC_DS1307 rtc;
char inblue = '$';
const int ledPin =  13;      
int ledState = LOW;             
long msa = 0;
long msb = 0;
bool sync = false;
DateTime now;
DateTime now1;
void setup () {
  pinMode(ledPin, OUTPUT);
  Serial1.begin(38400);
  Wire.begin();
  rtc.begin();
  now = rtc.now();
  delay(2000);
  msa = millis();
}

void loop () {
    delay(10);
    now = rtc.now();
    if (now1.second() != now.second())
      {
        msa = millis();
        now1 = now;
      }
    msb = (millis()-msa);
    if (msb > 999)
      msb = 999;
    Serial1.print(now.year(), DEC);
    Serial1.print('/');
    Serial1.print(now.month(), DEC);
    Serial1.print('/');
    Serial1.print(now.day(), DEC);
    Serial1.print(' ');
    Serial1.print(now.hour(), DEC);
    Serial1.print(':');
    Serial1.print(now.minute(), DEC);
    Serial1.print(':');
    Serial1.print(now.second(), DEC);
    Serial1.print(':');
    Serial1.print(msb, DEC);  
    Serial1.print(' ');
    inblue = '$'; 
    while (inblue != '\r')
    {
      ledState = HIGH;
      digitalWrite(ledPin, ledState);
      inblue = '$';
      if (Serial1.available())
        inblue = Serial1.read();
      if (inblue != -1){
        if (inblue != '$')
          Serial1.print(inblue);
      }
    }
    Serial1.println("\r");
    ledState = LOW;    
    digitalWrite(ledPin, ledState);

}


Data – Sample Data Stream recorded on SD card (LOGO00145.TXT)

2015/4/17 15:55:27:937 -0.03 -0.08 0.16 26.47

2015/4/17 15:55:27:950 -0.03 0.00 0.16 26.47

2015/4/17 15:55:27:983 -0.08 -0.03 0.14 26.51

2015/4/17 15:55:27:996 -0.10 0.03 0.16 26.47

2015/4/17 15:55:28:0 -0.08 0.00 0.18 26.51

2015/4/17 15:55:28:50 -0.03 0.03 0.19 26.56

2015/4/17 15:55:28:64 -0.03 0.00 0.16 26.59

2015/4/17 15:55:28:131 -0.07 0.03 0.14 26.56

2015/4/17 15:55:28:170 -0.07 0.03 0.14 26.56

2015/4/17 15:55:28:182 -0.03 0.08 0.16 26.59