Skip to main content

ARDUINO BASED WIRELESS LED ACTIVATION

In this mini-project, you’ll create two identical assemblies, each consisting of an Arduino and XBee, along with a button and a LED. When you press the button on one assembly, the LED on the other one lights up, and vice versa.
Figure 1: Control LEDs with XBee-equipped Arduinos.

Parts Required:

You’ll be making two assemblies, so you need two of everything!
  1. Arduinos (x2)
  2. XBees (x2)
  3. Breakout boards (x2)
  4. Pushbuttons (x2)
  5. Breadboards (x2)
  6. LEDs (x2)
  7. Jumpers
Project Description:

Follow these steps to assemble the XBee test platform: 


1. Solder the breakout boards:

Solder up your XBee breakout boards if you haven’t already. Depending on your kit, this could mean simply soldering in some header pins. 
On other kits, however, you must solder in LEDs, capacitors, and so on. 


2. Connect the XBees to the breakout boards:

Attach the XBees to their respective breakout boards. This typically involves simply plugging in the XBees’ pins to the appropriate holes in the breakout board. Just follow the directions that accompany your kit. 


3. Attach to breadboards:

Plug the breakout boards and XBees into the breadboards. You can see where to place it in Figure 2.
Figure 2: This diagram shows you how to create these XBee test modules.

4. Attach the pushbuttons, LEDs, and jumpers:

Attach these items as follows (also shown in Figure 2): 

A. GND on the XBee goes to GND on the breadboard. Connect the GND bus of the breadboard to the GND port of the Arduino. 
B. +5V on the XBee goes to 5V on the Arduino. 
C. TX on the XBee goes to RX on the Arduino. 
D. RX on the XBee goes to TX on the Arduino. 
E. Connect a button to pin 8 on the Arduino; the other end connects to the GND bus. 

You should end up with two identical units, and if you upload the Arduino code to both of them, they should work identically. Even cooler, the way the networks are set up, you could actually create three or more of these assemblies and they’ll all work the way you would expect. Press the button on one, and the LEDs on all the others will light up! It’s not super practical, to be sure, but it shows how easily you can set up an XBee network.


Wireless LED Code:

Upload the following code to both Arduinos. Remember, both modules are identical, down to the software. 

#include <Wire.h> 
const int buttonPin = 8; 
const int ledPin = 13; 
int buttonState = 0; 
void setup() 
Serial.begin(9600); 
pinMode(ledPin, OUTPUT); 
pinMode(buttonPin, INPUT_PULLUP); 
void process_incoming_command(char cmd) 
int speed = 0; 
switch (cmd) 
case ‘1’: 
case 1: 
digitalWrite(ledPin, LOW); 
break; 
case ‘0’: 
case 0: 
digitalWrite(ledPin, HIGH); 
break; 
void loop() { 
if (Serial.available() >= 2) 
char start = Serial.read(); 
if (start != ‘*’) 
return; 
char cmd = Serial.read(); 
process_incoming_command(cmd); 
buttonState = digitalRead(buttonPin); 
if (buttonState == HIGH) { 
Serial.write(‘*’); 
Serial.write(1); 
else { 
Serial.write(‘*’); 
Serial.write(0); 
delay(50); //limit how fast we update 
}
Download Project Code Click Here

Comments

Popular posts from this blog

ADVANTAGES AND DISADVANTAGES OF CORONA

Corona has many advantages and disadvantages. In the correct design of a high voltage overhead line, a balance should be struck between the advantages and disadvantages. ADVANTAGES (i) Due to corona formation, the air surrounding the conductor becomes conducting and hence virtual diameter of the conductor is increased. The increased diameter reduces the electrostatic stresses between the conductors. (ii) Corona reduces the effects of transients produced by surges. DIS-ADVANTAGES (i) Corona is accompanied by a loss of energy. This affects the transmission efficiency of the line. (ii) Ozone is produced by corona and may cause corrosion of the conductor due to chemical action. (iii) The current drawn by the line due to corona is non-sinusoidal and hence non-sinusoidal voltage drop occurs in the line. This may cause inductive interference with neighboring communication lines.

ADVANTAGES OF PER UNIT SYSTEM

PER UNIT SYSTEM The per-unit system expressed the voltages, currents, powers, impedances, and other electrical quantities basis by the equation: Quantity per unit (pu) = Actual value/ Base value of quantity ADVANTAGES OF PER UNIT SYSTEM While performing calculations, referring quantities from one side of the transformer to the other side serious errors may be committed. This can be avoided by using per unit system. Voltages, currents and impedances expressed in per unit do not change when they are referred from one side of transformer to the other side. This is a great advantage. Per unit impedances of electrical equipment of similar type usually lie within a narrow range, when the equipment ratings are used as base values. Transformer connections do not affect the per unit values. Manufacturers usually specify the impedances of machines and transformers in per unit or percent of name plate ratings. Transformers can be replaced by their equivalent series impedances. ...

ABSOLUTE AND SECONDARY INSTRUMENTS

The various electrical instruments may, in a very broad sense, be divided into (i) Absolute Instruments (ii) Secondary Instruments. Absolute Instruments are those which give the value of the quantity to be measured, in terms of the constants of the instrument and their deflection only. No previous calibration or comparison is necessary in their case. The example of such an instrument is tangent galvanometer, which gives the value of current, in terms of the tangent of deflection produced by the current, the radius and number of turns of wire used and the horizontal component of earth’s field.  Secondary Instruments  are those, in which the value of electrical quantity to be measured can be determined from the deflection of the instruments, only when they have been pre-calibrated by comparison with an absolute instrument. Without calibration, the deflection of such instruments is meaningless. It is the secondary instruments, which are most generally used in ev...