EL Sequencer/Escudo Dos Hookup Guide

Pages
Contributors: Toni_K
Favorited Favorite 5

Going Wireless

If you would like to add wireless capabilities to your project, there's just a few more steps to get up and running.

  • **Insert a radio unit: ** You can either use a paired XBee unit or an NRF24L01+ module. You will need to make sure headers are soldered on for either device. If you need additional information on adding an XBee module, please check out our tutorial here. On the EL Sequencer, you will also need to flip the XBee to FTDI switch to XBee to ensure XBee communication is working properly.

  • Update the Code

If using a Series 1 XBee:

Upload the 'SparkFun_XBee_EL_Sequencer.ino' sketch to your board. In the first section, the status LED is declared as an output, and the Serial connection is opened at 9600bps.

language:c
//Declare character 'val'
char val;

/*******************Setup Loop***************************/
void setup(){
  Serial.begin(9600); //Begin Serial communication for debugging
  pinMode(13, OUTPUT); //Set pin mode as output for status LED
  val = 'A';// button pressed, therefore sending  letter A

  Serial.println("EL Sequencer's XBee is Ready to Receive Characters");
  digitalWrite(13,LOW); //set Status LED off
  delay(1000); //Wait 1 second
}

The main loop of the code simply waits for the XBee unit to receive the character 'A' from a remote XBee unit. If the character is received, the status LED is turned on, and a message is output to the serial terminal.

language:c
/*******************Main Loop***************************/
void loop(){

  //Check if XBee is receiving data from other XBee
  if(Serial.available()){
    val = Serial.read();

    //Check to see if character sent is letter A
    if(val == 'A'){
        digitalWrite(13,HIGH); //turn ON Status LED
        delay(50);
      Serial.println("Character Received");
    }

    else{
      digitalWrite(13,LOW); //turn OFF Status LED
    }
  }
}

If using an NRF24L01+:

You will need to use the RF24 library with the nRF24L01+ boards. We have a tutorial with more information regarding installing this library here.

We recommend using the RF24/examples/Usage/led_remote.ino example sketch. This is already configured to be compatible with the EL Sequencer with 6 channels of EL wire attached and will trigger each channel based on buttons hit on the remote unit.

The EL Sequencer will trigger the channels on and off based on the LED role in the code.

language:c
      //
      // LED role.  Receive the state of all buttons, and reflect that in the LEDs
      //

      if ( role == role_led )
      {
        // if there is data ready
        if ( radio.available() )
        {
          // Dump the payloads until we've gotten everything
          while (radio.available())
          {
            // Fetch the payload, and see if this was the last one.
            radio.read( button_states, num_button_pins );

            // Spew it
            printf("Got buttons\n\r");

            // For each button, if the button now on, then toggle the LED
            int i = num_led_pins;
            while(i--)
            {
              if ( button_states[i] )
              {
                led_states[i] ^= HIGH;
                digitalWrite(led_pins[i],led_states[i]);
              }
            }
          }
        }
      }

The code waits until the receiver gets data coming in and then swaps the LED states accordingly (in this case, the LEDs will be replaced with the EL channels).

That's it!

That's all you need to do to add wireless capabilities to your EL project. You can now remotely control your EL Sequencer project.