lalo630 8 Posted October 4, 2016 Share Posted October 4, 2016 Hello, I want to make a wireless thermometer using two microcontrollers. How do I write the code in Energia to transmit and receive a variable using a 433 Mhz RF module? Transmitter Setup: I have a TM4C123G connected to a RF transmitter using TX(3) pin 34 on the MCU. The TM4C123G is also connected to a LM34DZ Temp sensor. I need help to modify this working code to send the temperature variable using tx(3) pin 34 /*TM4C123G*/ //initializes/defines the output pin of the LM34 temperature sensor int outputpin= A11; // (pin # 2), use A11 analog input //--------------------------------------------------------------------- //this sets the ground pin to LOW and the input voltage pin to high void setup() { Serial.begin(9600); Serial3.begin(9600); //---------------------------------------------------------------------- } void loop() { int rawvoltage= analogRead(outputpin); float millivolts= (rawvoltage/4095.0) * 3300; float fahrenheit= millivolts/10; Serial3.write(fahrenheit); //transmits temperature to receiver Serial.println(fahrenheit);//displays temperatur on Serial monitor delay(200); } Receiver Setup: I also have a MSP432 connected to a RF receiver using rx pin 3 on the MCU. The MSP432 is connected to a 16x2 LCD. I need help to modify this working code to receive the temperature variable using rx pin 3 and display to the lcd. /*Receiver MSP432*/ #include <LiquidCrystal_I2C.h> #include <Wire.h> #define rfReceivePin 3 //RF Receiver pin = pin 3 unsigned int data = 0; // variable used to store received data byte address = 0x3F; // LCD I2C address int columns = 16; // number of columns on LCD int rows = 2; // number of rows on LCD LiquidCrystal_I2C lcd(address, columns, rows); //----------------------------------------------------------------- void setup() { lcd.init(); // initialize the lcd lcd.backlight(); } //----------------------------------------------------------------- void loop() { lcd.clear(); lcd.setCursor(0,0); data=analogRead(rfReceivePin); //listen for data on pin 3 lcd.print("Temperature"); lcd.setCursor(0,1); lcd.print(data); delay(500); } Quote Link to post Share on other sites
energia 485 Posted October 4, 2016 Share Posted October 4, 2016 Maybe I am missing it but I don't see a question in here. What is working and what is not? Can you please provide details? Quote Link to post Share on other sites
lalo630 8 Posted October 4, 2016 Author Share Posted October 4, 2016 How do I write the code to transmit and receive the temperature using a rf module? I want to transmit the temperature wireless from the tm4c123g to the msp432. Working: The TM4C123G can display the temperature correctly on the Energia serial monitor. The MSP432 is connected to an LCD and that is also working. The TM4C123G has the rf transmitter connected to tx(3) pin 34 The MSP432 has the rf receiver connected to rx pin 3 Problem: I do not know how to program the RF module to work. Quote Link to post Share on other sites
energia 485 Posted October 4, 2016 Share Posted October 4, 2016 Which RF module are you using? Quote Link to post Share on other sites
lalo630 8 Posted October 4, 2016 Author Share Posted October 4, 2016 I am using a 433 MHz RF module I bought on ebay. Here is the link: http://www.ebay.com/itm/251893229455?_trksid=p2057872.m2749.l2649&var=550779246789&ssPageName=STRK%3AMEBIDX%3AIT Quote Link to post Share on other sites
lalo630 8 Posted October 4, 2016 Author Share Posted October 4, 2016 This is the Transmitter Setup: This is the Reciever Setup: Quote Link to post Share on other sites
energia 485 Posted October 6, 2016 Share Posted October 6, 2016 What you need is the VirtualWire library: https://www.pjrc.com/teensy/td_libs_VirtualWire.html. Unfortunately this library is arduino specific and you will need to modify it to run on TivaC and MSP432. Robert lalo630 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.