Hey thanks for your advise.
I'm using a simple 433 transmiter and receiver, I will put a picture below. For the antenna I used a quarter wave length (17.3cm wire). This transmitter can take 12volts so I put the Vcc at 12 volts to get the maximum TX power.
The transmitter is sending me the status of my scuba compressor installed in my Camping car (RV). I built the receiver with a small OLED display in a small box (9 volts battery) While the compressor is filling my scuba tank, I can move around and see on the remote, the status like PSI, Oxygen, temperature and Cabon monoxyde.
If I'm on the good side of the camper I can receive the signal for almost 100 feets but on the other side of the camper or when I'm in front, I can receive only at 20 feets If I'm lucky.
Yes I know that lower is the frequency, better it can pass trough obstacle but when I look at the NRF24L01, it look better built than the small 433Mhz. I was thinking that maybe the quality of the circuit would made it a better transmitter. Also with the NRF24L01, you can choose a different channel in case of local interfrence.
All this to say. If you know how I can modify the code to change the transmitting mode and get a better range, I will begin with that since it's already there.
FYI. It transmit only the numeric value for each sensor with a comma between each and the receiver display it on the OLED. ,1981,20.4,27.2,33,
See the code of my transmiter and tell me what I can do OR tell me if a better 433 transmitter exist.
#include <VirtualWire.h>
#include <Wire.h> //IIC Library
#include <elapsedMillis.h>//For the Status
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
boolean constat = 1; //Status Variable 1=On at start, 0=off at start
boolean splashcleared;//Bool to hold if splash screen has been cleared
String text = " ";//String to hold the text
elapsedMillis packettimer;//The timer for status
#define interval 1500//The threshold for how long it can go without "6"(The connection indicator)
void setup()
{
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
pinMode(12, OUTPUT); //Module VCC
digitalWrite(12, HIGH); // turn the VCC to High
vw_set_rx_pin(11);// set you rx pin
vw_setup(2500); // Bits per sec. Lower for further distance. Make sure this matches the number on the transmitter
vw_rx_start(); // Start the receiver PLL running
display.clearDisplay();
display.setTextColor(WHITE);
display.setCursor(25,0);
display.setTextSize(1);
display.print(F("Scuba Receiver"));
delay (1500);//set this to the interval
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (packettimer< interval){//It the status of the connection is good and "6" was recieved in the last 1.5 secs.
if (splashcleared==0){//if screen hasn't been cleared of status
display.clearDisplay();
display.display();
splashcleared=1;//make sure it won't be again
}
}//make sure the screen wont clear again
if (constat == 1) { //If the status bar is enabled
if (packettimer < interval) { //It the status of the connection is good and "6" was recieved in the last 1.5 secs.
display.setTextColor(WHITE, BLACK);
display.setCursor(115,0);
display.setTextSize(1);
display.print(F("OK")); // RF Signal is OK
display.display();
}
else if (packettimer > interval) {//It the status of the connection is bad and "6" was not recieved in the last 1.5 secs.
delay (450);// wait
display.clearDisplay();
display.setTextColor(WHITE, BLACK);
display.setTextSize(1);
display.setCursor(120,0);
display.print(F("X")); // Not receiving RF Signal
display.display();
delay (200);//wait
}
}
if (vw_get_message(buf, &buflen)) // Non-blocking
{
packettimer = 0;//Reset timer when data is recieved
text.remove(0);//clear all text from string: text
text = (char*)buf; //put new data into string "text"
text.remove(buflen - 1); //Remove garbage after the end of the text
if (text.startsWith("6")) {//"6" is sent every 300 ms to check the signal, and we dont want it to display
packettimer = 0;//Reset timer when data is recieved
if (splashcleared == 0) { //if screen hasn't been cleared of status
display.clearDisplay();
display.display();
splashcleared = 1; //make sure the screen wont clear again
}
}
else if (text.startsWith("clear")) {
display.clearDisplay();
display.display();
}
else if (text.startsWith("status")) {
constat = 1; //(ConnectionStatus)this variable will make the signal show
}
else if (text.startsWith("nostatus")) {
constat = 0; //(ConnectionStatus)this variable will block the signal from showing
}
else if (text.startsWith(",")) {
int sepLocation[5];
int index = text.indexOf(",");
int i = 0;
String extractedValues[4];
while (index >= 0) {
sepLocation[i] = index;
i++ ;
index = text.indexOf(",", index + 1);
}
for (int o = 0; o < 4; o++) {
extractedValues[o] = text.substring((sepLocation[o] + 1), sepLocation[(o + 1)]);
}
display.setCursor(0, 0);
display.setTextColor(WHITE, BLACK);
display.setTextSize(1);
display.print("PSI = " + extractedValues[0]);
display.display();
display.setCursor(0, 12);
display.setTextColor(WHITE, BLACK);
display.setTextSize(1);
display.print("Oxygen = " + extractedValues[1] + "%");
display.display();
display.setCursor(0, 25);
display.setTextColor(WHITE, BLACK);
display.setTextSize(1);
display.print("Temp = " + extractedValues[2] + "C");
display.display();
display.setCursor(75, 25);
display.setTextColor(WHITE, BLACK);
display.setTextSize(1);
display.print("CO = " + extractedValues[3] + "");
display.display();
}
}
}