temp sensor over 433Mhz
BBC MicroBit with RF 433Mhz receiver reading Oregon-Scientific wireless temperature sensor. Originally written for the Raspberry Pi but easily converted for the little microbit.
README.md
- Committer:
- daw9000
- Date:
- 2016-07-26
- Revision:
- 2:7455dae4e624
File content as of revision 2:7455dae4e624:
/* Program Oregon Written by David Wright, Jan 2015. */ /* thanks and plagarised from various internet sources on oregon sensors. Paul(DISK91.com), ALTelectronics for their document on */ /* Oregon Scientific RF protocol v1.0, kevinmehall on github for rtldr-433m-sensor, Alexander Yerezeyev and more .... */ /* */ /* This Program reads a 433Mhz transmission from an Oregon version 1 Protocol Temperature Sensor */ /* */ /* Programming uses the logic of first detecting the preamble portion of transmission by counting the number of short 1 pulses */ /* Next the progam monitors the 3 sync pulses and translates the last sync pulse to determine the first data message bit either 1 or 0 */ /* From knowing the first message data bit the program determines the next 31 message data bits using the logic as follows:- */ /* Two SHORT pulses means that the message data bit is the same as the previous message data bit (we know first so can do this) */ /* One LONG pulse means that the message data bit is opposite (inverse) of the previous message data bit. */ /* */ /* The resulting 32 bit message is reversed to form 8 nibbles(4 bit). These nibbles are decoded to produce the data values. */ /* */ /* This program is quite basic and simplistic in that there is no error checking and only really gets temperature, channel and low bat */ /* I wrote this program to learn C programming from being a visual basic and java programmer and as an aid to learning to code */ /* hardware interfaces on my Raspberry Pi B+. I found plenty of code for various Oregon sensors but none I could easily understand */ /* from the C or Python code. Hence this program does nothing clever using bitwise or memory facilities or uses no rising clock edges */ /* , falling clock edges, clock ticks etc. Just simple time measurement and ONs and OFFs. Also I dont do any hex conversions. */ /* There are no hex conversions because for channel, temperature and low battery all the hex and decimal values are the same i.e. */ /* only numbers 0 to 9 are used for each part of the message. The temp minus sign and low battery are determined from the raw binary */ /* in nibble 2 (third nibble as it starts nibble zero). */ /* */ /* If you wish this program can be improved on by adding error checking by using the checksum (hex conversion needed) and/or */ /* by storing values and checking against the second transmission of the same message (all messages sent twice, I sleep through the */ /* second transmission Zzzzz). */ /**/ /*IMPORTANT NOTE : Most 433Mhz receivers are 5v so will not be powered from MicroBit. The data output is low voltage 3v so OK for MicroBit. */ /* FastIO used because pin bashing was too slow. Maybe improvements could be made by using mbed interruptln */ /* Feel free to change, copy, or whatever ... */