This example shows how to set up and use simple and inexpensive computer hardware (Android and Raspberry Pi) for monitoring temperature.
For Android < 5.x GNUroot worked well, but not as well since (for pascal).
RPi Zero Wireless Temperature Sensing
Parts for an embedded temperature sensing kit
CAndroid - Check out C4Droid on the play store, uses tcc (if don't install anything else)
RPi - sudo apt-get install tcc (then use nano)
PythonAndroid - Use the cloud?
RPi - to be added here ASAP
PascalNew wiki page for Android and RPi
To install Free Pascal 2.6.4 on the RPi:
- sudo apt-get install fpc
To use Free Pascal (some options are listed here)
1) ppcarm (see first two examples here)
3) fp (starts text mode IDE)
Notes on using the Free Pascal Text Mode IDE:
- Alt-F calls up the file menu
- How enable mouse?
Here is unfinished code for software that sends emails (and texts) with the temperature (and power status) every 3 hours.
- The arm code has the latest dlptempg.pas so be sure to update the older x86_64 code from that.
- This code will hopefully be uploaded later to this page and this page. Your comments and feedback are appreciated very much!
- The CtrlTerm.pas code included is a version that provides configuration with command line parameters.
Configuration notes for the above code:
- In a terminal in the folder, compile 2 programs:
- Clean dcu folder:
- The sendemails.sh file (in bin) must be edited for your email, and the file must only terminate each line with LF (not CR/LF) or you'll get this error:
sendemails.sh: 43: sendemails.sh: Syntax error: end of file unexpected (expecting "then")
- cd bin
sudo ./dlptempg - so creates message.txt file (first temp reading is wrong). After file is created do Ctrl-C - to stop dlptempg
- Check that
sh sendemails.sh 0 subject message.txt (sends text)
sh sendemails.sh 1 subject message.txt (sends email)
both run OK
- Return to home folder
- sudo nano .bashrc (then add this at the end of the file: )
if [ $(tty) == /dev/tty1 ]; then
- Should now work to auto login and auto start the program. Can press "s" key at any time to send both text and email (to test). Ctrl-C still works to stop the program.
Other ideas: use bluetooth to change settings, watchdog, do same for the BeagleBone, monitor sump pump operation...
Use bluetooth (from phone) to reboot the Zero. Copied instructions from here (most by Douglas6 - Thanks!).
- Start by adding the Serial Port Profile. Edit this file:
- Add a ' -C' compatibility flag at the end off the ExecStart= line, and add a new line to add the SP profile. The two lines should look like this:
- Save the file and do this in a terminal:
- Create a new file with sudo
- enter the following:
- Save the file, then enable that to start at boot time by doing this in a terminal:
- Reboot by doing this in a terminal:
Pair and Connect on phone (using BlueTerm on Android). then do the above command.
For power detection (first pass showing Micro Center prices), run the RPiZw (and your WiFi router) on a battery backup system (~40 US dollars). Purchase a 5V switching power supply (QVS ARUSB-2.5A is ~11 US dollars) to plug into raw power, a 1.5K ohm 1/4 watt resistor, and a Micro-USB extension cable (QVS CC2217-03MF is ~9 US dollars) to cut in half then install the jack onto the DLP-TEMP-G sensor 2 input (along with the 1.5K resistor between Data and Ground so is a pulldown that matches the DLP-TEMP-G onboard pullup resistor). Change the dlptempg.pas code for the voltage 5 places from 0.5 to 3.75 (should use a constant). Run the dlptempg program (without the raw power applied) and verify that the voltage displayed every ten seconds is about 2.5V. Plug in the raw power and it should change to 5.0V. The dlptempg program is intended to ignore short power interruptions.
Other things to check out:
Return to home page.
Please share your ideas, comments and suggestions. Thanks!