Home | pfodApps/pfodDevices | WebStringTemplates | Java/J2EE | Unix | Torches | Superannuation | | About Us
 

Forward Logo (image)      

pfodApp controlled IR Temperature Meter
Android/Arduino based InfarRed(IR) Temperature Meter

by Matthew Ford 16th August 2016 (original 9th September 2013)
© Forward Computing and Control Pty. Ltd. NSW Australia
All rights reserved.

Data Logging, Arduino based IR Temperature Meter
Displayed and logged on your Andriod
TM mobile using pfodApp.
NO Android Programming required.

pfodApp IRTemp Meter (Arduino/Android Bluetooth)

This project builds on the IRTemp Meter Terminal by adding Bluetooth and sending the readings to pfodApp on your Android mobile for logging to a file. The log file of the temperature readings on your mobile can then be uploaded to your computer.
No Android programming is required.
You can make this unit stand alone and portable by adding a 9V battery as described here.

In addition to the parts required for the IRTemp Meter Terminal, this project needs a Bluetooth Shield and pfodApp running on and Android mobile. The complete parts list is here.

Converting the Sketch to a pfodDevice

If you have not already download the pfodIRTemp library, then download the pfodIRTemp.zip file and and unzip it to your Arduino library directory. All the sketches for the projects described here are included as examples.

The sketch from the previous project needs to be turned into a pfodDevice in order to connect to the pfodApp on your Android mobile. At its simplest, this means the sketch has to respond to every pfod message sent by the pfodApp with a valid pfod response and tell the pfodApp what is opening screen should be. See the pfod Specification for all the valid responses.

The Streaming RawData message, {=title} instructs the pfodApp to open the Streaming Raw Data screen which display and non-pfod messages received. In this case the IR temperature readings. The sketch below will return this message when the pfodApp asks for the pfodDevice's main menu, i.e. when the pfodApp sends {.} Opening the Raw Data screen. pfodAppV2 automatically starts saving all the data received into a file on your mobile even without opening the RawData screen.

First download pfodParser library zip file and install it following the instructions on that page. The pfodParser parses pfod messages from a pfodApp and returns the (non-zero) command when the closing } of message is received. Adding the following code to the top of the sketch loop() method, above the existing IRTemp code, parses every pfod message received by the Serial connection. For the . cmd the Streaming RawData message is returned, {=IR Temp Readings} The text after the = will be displayed on your mobile as the title of the screen. For all other pfod messages the sketch and just returns the empty message {} so the pfodApp does not time out and close the connection.

  byte  cmd = parser.parse();
  if (cmd != 0) { // got something
    if (cmd == '.') { // main menu request
      sendMainMenu();
    } else { // we don't handle message
      Serial.print(F("{}")); // BUT always respond or pfodApp will timeout
    }
  }

and add the sendMainMenu() method to the end of the sketch

  void sendMainMenu() {
    Serial.print(F("{=IR Temp Readings}"));
  }  


The full sketch is show here (pfodUnoIRTempData.ino).

Remove the Bluetooth Shield, open the pfodUnoIRTempData example sketch in the Arduino IDE, ie choose File → Examples → pfodIRTemp → pfodUnoIRTempData and upload it to the Uno.

To test the sketch, leave the Bluetooth Shield off and just plug in the prototype board as shown in the IR Temp Meter Terminal project. Open the SerialMonitor and you should see the IR Temperature readings as before. However if you send the get main menu pfod command, {.}, the Uno will now respond with a Streaming RawData screen message, {=IR Temp Readings}

Connecting to Your Android Moble, pfodApp

First set the switches on the Bluetooth Shield. Set the 3V/5V switch to 5V and set the To Board/To FT232 switch to the To Board position. Then unplug the USB cable and fit the Bluetooth Shield as shown in the photo above and then plug the USB cable back in to power up the boards, or use an external power supply.

Set up a Bluetooth connection in the pfodApp for this Bluetooth shield, as described in pfodAppForAndroidGettingStarted.pdf Name the connection, for example “IR Temp Data”. Then when you connect to that connection, pfodApp will display the IR temperature data and automatically save it to a file on your mobile.

You can then upload this temperature data to your computer, as described in in pfodAppForAndroidGettingStarted.pdf for further processing.

The next stage in this project, pfodApp IRTemp Meter with Menus, displays the current reading and an averaged reading on the main screen, lets you change between Fahrenheit and Celsius, lets you choose the number of readings to average over and lets you start logging the readings. Again no Android programming is required to add these menus.

AndroidTM is a trademark of Google Inc. For use of the Arduino name see http://arduino.cc/en/Main/FAQ


The General Purpose Android/Arduino Control App.
pfodDevice™ and pfodApp™ are trade marks of Forward Computing and Control Pty. Ltd.


Forward home page link (image)

Contact Forward Computing and Control by
©Copyright 1996-2020 Forward Computing and Control Pty. Ltd. ACN 003 669 994