Open PhysicsUofRAUI opened 5 years ago
In this instructable they used a similar link kit but connected to arduinos instead https://www.instructables.com/id/RF-315433-MHz-Transmitter-receiver-Module-and-Ardu/
This instructable involves the use of a similar receiver to receive information like this with a raspberry pi. https://www.instructables.com/id/Super-Simple-Raspberry-Pi-433MHz-Home-Automation/
This could be useful when completing this issue
Here is a couple links to help with the raspberry pi code
Here is some code I have written to transmit the data. Pretty simple but I think it should work
/*
By: Kody Rogers
Date: 15/8/2018
Purpose: This block of code was written to transmitt code to a Raspberry Pi
in connection with the development of a system to monitor grain temperature
in a bin.
Documentation: Some extra Documentation
The library being used to send the messages
http://www.airspayce.com/mikem/arduino/RadioHead/index.html
*/
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
char *sensor_one;
char *sensor_two;
char *sensor_three;
/*
Sets
speed = 2000,
reciever pin = 11,
transmitter pin = 12,
Next two are to now whether to transmitt or not
pttPin = 10,
pttInverted = false
*/
RH_ASK driver(2000, 2, 12, 11);
void setup() {
Serial.begin(9600);
pinMode(11,OUTPUT);
// Set pin 11 to high so we will always transmitt
digitalWrite(11, HIGH)
if (!driver.init()){
Serial.println("init failed");
}
}
void loop() {
/*
The next three blocks of code get the data (this will not work right now as the
code to get the data will have to be added later), sends it, then waits. The code
does compile with the arduino compiler right now but only if you comment out the first
line (looks like this 'sensor_one = getData(1);'), but it has not been tested. A test could be done by
uncommenting the first line of each (looks like this '//sensor_one = "hello";') then
the code should send "hello" all the time as long as it is wired correctly
*/
//sensor_one = "hello";
sensor_one = getData(1);
driver.send((uint8_t *)sensor_one, strlen(sensor_one));
driver.waitPacketSent();
// sensor_two = "hello";
sensor_two = getData(2);
driver.send((uint8_t *)sensor_two, strlen(sensor_two));
driver.waitPacketSent();
//sensor_three = "hello";
sensor_three = getData(3);
driver.send((uint8_t *)sensor_three, strlen(sensor_three));
driver.waitPacketSent();
delay(1000);
}
Currently not too relevant, but I will leave it up.
There will need to be some code written for sending the data, that is collected from the sensors by the Arduino, to the Raspberry Pi (under the current plan). The way this is currently going to be done is with the following RF Link Kit .