
By doing it this way, I am limiting myself to 2 digit degrees. On the receiver side, the data will be split into single characters. First, the data is read into the variable as integers, then the integers are converted to an array of characters, and finally they are joined together. To send the humidity and the temperature in one single send statement, I join them together since this is one-way communication. Vw_send((uint8_t *)msg0, strlen(msg0)) // Sending the msgĭelay(5000) // Wait five seconds and it again Strcat(msg0, msg1) // Adding/joining the two arrays Itoa(tem, msg0, 10) // Converting the temperature to an array of chars Itoa(hum, msg1, 10) // Converting humidity to an array of chars Tem = dht.readTemperature() // Variable holding temperature Hum = dht.readHumidity() // Variable holding humidity Vw_set_tx_pin(9) // VirtualWire transmit pin Vw_setup(4800) // VirtualWire communication speed Follow the labels on the schematic to connect to the Arduino Mega. Please note that the receiver is an Arduino Mega, and it is not in the schematic.

In this example, I am not going to tie the unused pins on the microcontroller to a pad for further development. Schematic diagrams Transmitter (click for larger image):

Virtual wire library for arduino code#
*Note that all code is in zip form at the bottom of this article Hardware To prevent that from happening, I am turning it on when it transmits, and turning it off when it is not transmitting. It might also interfere with other RF applications. The 433MHz transmitter module will oscillate and transmit noise when it is not transmitting data. In this article, I am using the VirtualWire library to transmit and receive data. The library works with Arduino IDE 1.6.2 and 1.6.5. Using the built-in UART is not recomended because the receiver will pick up all kinds of noise, so the microcontroller will not act the way you want it to. One of them is using an already-made library like RCSwitch, Radiohead, or VirtualWire. It is also possible to send raw data with the microcontroller's built-in UART feature. There are many ways you can send small amounts of data with an Arduino or other ATMega-microcontrollers. You can read another article about the sensor here.

The temperature and humidity sensor is the DHT11.
Virtual wire library for arduino how to#
In this article I will show you how to make a circuit that measures temperature and relative humidity and send those measurements with an off-the-shelf 433MHz RF module.
