Measure Temperature using the Thermistor
You require the Bluetooth Starter Kit to complete these exercises. There are 2 exercises. First you will connect up the Bluetooth Starter Kit and thermistor and run the Thermometer app. Second you will use Intent to communicate between the App Inventor program and the Thermometer app
I) Connect the Bluetooth Starter Kit and thermistor and Run the Thermometer App
- Connect the thermistor to the Light Application Adaptor if it has not yet been done
- Connect the thermistor to the Light Application Adaptor screw terminals labeled IDAC and AGND
- Connect a wire from IDAC to AIN3
- Connect a wire from AGND to AIN2
- Connect up the Bluetooth Starter Kit and power up the circuit by putting in batteries to the battery holder. Note the Mac Address.
- On your smartphone goto Settings->Applications and enable Unknown sources. Download and install the Thermometer App Temperature.apk to your Android smartphone.
- When the Thermometer App runs
- Turn on Bluetooth if it is off
- Click the Get Address button if you are running it the first time. If the mac address of your bluetooth DAQ module is not displayed, click the Scan for devices button. If this is the first time your phone is connecting to this particular device, you will need to select your device and pair with it using the pin code 1234
- Click on the Start checkbox to start temperature measurements. You will see the measured temperature displayed. Uncheck to stop.
- Click on either the Red or Green radio button to turn on the respective LED on the Light Application Adaptor
For more information, see Using thermistor and DAQ to measure temperature
II) Using Intent to connect the Thermometer App to the App Inventor Program
Download intent.zip to your computer and then upload to your App Inventor account
Designer
4 components are used
- Basic->TextBox
- Basic->Label
- Basic->Button
- Other stuff->ActivityStarter (This is a non visible component, that is it will not appear on the screen)
Block Editor
The following blocks are used
- My Blocks->Button1->Button1.Click
- My Blocks->TextBox1->TextBox1.Text
- My Blocks->Label1->Label1.Text
- My Blocks->ActivityStarter1->ActivityStarter1.Action << Built-In->Text->text string com.emant.temperature.START
- My Blocks->ActivityStarter1->ActivityStarter1.ActivityClass << Built-In->Text->text string com.emant.temperature.TempIntent
- My Blocks->ActivityStarter1->ActivityStarter1.ActivityPackage << Built-In->Text->text string com.emant.temperature
- My Blocks->ActivityStarter1->ActivityStarter1.ExtraKey << Built-In->Text->text string LED
- My Blocks->ActivityStarter1->ActivityStarter1.ExtraKey
If the text value assigned is red (not case sensitive), the RED LED will light up. Any other value will light up the GREEN LED
- My Blocks->ActivityStarter1->ActivityStarter1.ResultName << Built-In->Text->text string TEMP
- My Blocks->ActivityStarter1->ActivityStarter1.StartActivity
- My Blocks->ActivityStarter1->ActivityStarter1.AfterActivity
- My Blocks->ActivityStarter1->ActivityStarter1.Result
The measured temperature from the Thermometer App is returned
Activity parameters are defined by the Thermometer App. When the result is available from the started activity, an ActivityStarter1.AfterActivity event is activated. What is returned is also defined by the Thermometer App.