Sending potentiometer values with 433 MHz Modules

Hi all, I was wondering if someone has the idea how to do this: https://www.youtube.com/watch?v=14P4QXRiVF4", I have this R and TX modules and 2 arduino uno, I tried to do something but i relly don t know how, i went on google, but no success. :(

I am using the Virtualwire library. I tried to fing out how to send potentiometer values from one arduino to another using 433 Mh rx and tx modules.

If someone has a demo code or knows how to do this , I need some help :/ :) Thank you for your time :)

I am using the Virtualwire library.

For what? A doorstop?

Where IS your code?

I wrote here that i don t know how to do it! i don t have a code, i searched but i didn t find anything. I sayed that i am using the Wirtualwire library because some people are using other libraryies for the 433mHZ tx and rx modules.

I sayed that i am using the Wirtualwire library because some people are using other libraryies for the 433mHZ tx and rx modules.

This implies that you can send SOMETHING back and forth. This implies that you have SOME code that uses the VirtualWire library.

Making that code read a potentiometer, and send the value, is trivial. Writing ALL the code is less so.

Here is the example of the virtual wire library

Receiver

// receiver.pde
//
// Simple example of how to use VirtualWire to receive messages
// Implements a simplex (one-way) receiver with an Rx-B1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
// $Id: receiver.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $

#include <VirtualWire.h>

void setup()
{
    Serial.begin(9600);	// Debugging only
    Serial.println("setup");

    // Initialise the IO and ISR
    vw_set_ptt_inverted(true); // Required for DR3100
    vw_setup(2000);	 // Bits per sec

    vw_rx_start();       // Start the receiver PLL running
}

void loop()
{
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(buf, &buflen)) // Non-blocking
    {
	int i;

        digitalWrite(13, true); // Flash a light to show received good message
	// Message with a good checksum received, dump it.
	Serial.print("Got: ");
	
	for (i = 0; i < buflen; i++)
	{
	    Serial.print(buf[i], HEX);
	    Serial.print(" ");
	}
	Serial.println("");
        digitalWrite(13, false);
    }
}

transmitter

// transmitter.pde
//
// Simple example of how to use VirtualWire to transmit messages
// Implements a simplex (one-way) transmitter with an TX-C1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
// $Id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $

#include <VirtualWire.h>

void setup()
{
    Serial.begin(9600);	  // Debugging only
    Serial.println("setup");

    // Initialise the IO and ISR
    vw_set_ptt_inverted(true); // Required for DR3100
    vw_setup(2000);	 // Bits per sec
}

void loop()
{
    const char *msg = "hello";

    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
    delay(200);
}

Here is the example of the virtual wire library

What part of the project are you doing? What part are we doing?

Can you read from the potentiometer? Can you use sprintf() to convert the value to a string? If so, why can't you substitute the string you populate with sprintf() for the string that the example sends?

so i would like to control a fan speed wirelessly, to control the fan speed i am using the TIP120 to control the speed, from this tutorial http://www.instructables.com/id/Use-Arduino-with-TIP120-transistor-to-control-moto/?lang=de
so , i tried and it works, when i change the values from 0-255 changes the fan speed.

Yes it would read it from the potentiometer. I found the tutorials but i don t know how to send the variables.
i don t know how to use this sprintf() :frowning:

Yes it would read it from the potentiometer.

When you write the appropriate code, it will.

i don t know how to use this sprintf()

Good thing Mr. Google does, then.

So , wrote a demo code but i don t know how to convert it to a string, i wen t on google looking for this but i have no idea

Transmitter( i am not sure if i wrote good this with sending byte , i relly have no idea

#include <VirtualWire.h>

int potPin=A3;
int input = 0; 
char *controller;
void setup() {
   
  Serial.begin(9600);  
  
  
vw_set_ptt_inverted(true); 
vw_set_tx_pin(12);
vw_setup(4000);
}

void loop()
{
  
 int potVal = analogRead(potPin);
   byte servoVal = map(potVal, 0, 1023, 0, 180);

   Serial.write(servoVal);
  
vw_send((uint8_t *)"byte servpVal", 1); //here i am not sure if it is good

}

receiver and i don t know how to make it receive the value

#include <VirtualWire.h>







void setup()
{
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_set_rx_pin(11);
  vw_setup(1000);  // Bits per sec
  vw_rx_start();       // Start the receiver PLL running
  

  
}
void loop()

{
  
  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;

  if (vw_get_message(buf, &buflen)) 
  {
   //i don t know what to put here :(
}
}
vw_send((uint8_t *)"byte servpVal", 1); //here i am not sure if it is good

It is, if what you want to do is send the letter 'b'.

If you want to send the VALUE:

char crapToSend[10];

sprintf(crapToSend, "%d!", servoVal);

vw_send((uint8_t *)crapToSend, strlen(crapToSend)); // here I AM sure it is good
   //i don t know what to put here :(

How about:

buf[buflen] = '\0'; // Null terminate the array
Serial.print("I got: [");
Serial.print(buf);
Serial.println("[");

Then, YOU take a stab at figuring out what to do with atoi().

The homework hotline is now closed.

Thank you, i will try to make it now, thanks again :) it is better now when i think about it. :D