Introduction: How to Control a ROBOSAPIENS Robot With Cayenne IoT

Hi! I’m

Neoxelox and I will show you how to control a ROBOSAPIENS robot with Cayenne IoT!

We need:

- Cayenne Account

- IR Emitter (mine is KEYES IR Emitter)

- Arduino board (Obviously)

- Arduino ethernet shield (mine is W5100)

- Robosapiens (Obviously)

- IRremote library (IT HAS TO BE THIS LIBRAY BECAUSE I MODIFIED IT TO WORK WITH ROBOSAPIENS) http://www.mediafire.com/file/noes8859gos4ka4/Arduino-IRremote-master_%281%29.zip

Step 1: Connect the IR Emitter to Arduino and Also the Triggers

Connect the IR Emitter to Arduino board.

Pinout:

IR Emitter / Arduino

pin "-" ---> pin GND

this pin doesn't have any letter so, the middle pin ---> pin 5V

pin "S" ---> digital pin 3 or other digital pin (It cannot be pin 0,1,2 or 13)

Triggers:

I was thinking what is the easiest way to do this project, and I realized if we connect a wire through digital pin 9 to 8 and digital pin 7 to 6 is the best way to do it, so:

Connect Arduino digital pin 9 to Arduino digital pin 8, repeat with 7 to 6.

Step 2: The Code

Just copy that (Obviously you need to change the line 33 with your IR Emitter digital pin.

/*
Cayenne Button Widget Example

This sketch shows how to set up a Button Widget with Cayenne.

The Cayenne Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps: 1. In the Cayenne Dashboard add a new Button Custom Widget. 2. Select a digital pin number. Do not use digital pins 0 or 1 since those conflict with the use of Serial. 3. Attach a digital output device (e.g. a LED) to the digital pin on your Arduino matching the selected pin. 4. Set the token variable to match the Arduino token from the Dashboard. 5. Compile and upload this sketch. 6. Once the Arduino connects to the Dashboard you should be able to control the digital output device with the Button widget.

Notice that there isn't much coding involved to interact with the digital pins. Most of it is handled automatically from the Cayenne library.

For further examples of how to receive data from Cayenne see the example sketches under Actuators. */

#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space

// If you're not using the Ethernet W5100 shield, change this to match your connection type. See Communications examples. #include

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.

char token[] = "******";

#include

#include IRsend irsend;

IRrecv irrecv(3);

void setup() {

pinMode(8, INPUT); pinMode(6, INPUT); Serial.begin(9600); Cayenne.begin(token); }

void loop() {

Cayenne.run();

if(digitalRead(8)==HIGH){

irsend.sendRSV1(134);

}else{ irsend.sendRSV1(142); }

if(digitalRead(6)==HIGH){

irsend.sendRSV1(135);

}else{ irsend.sendRSV1(142); }

}

Step 3: Configure Cayenne DashBoard

Just select a button custom widget, and modify it as the picture shows.

Step 4: Test It and You Finish It!

Hope you like it!!! If you want to know more movements I let you this table:

http://www.mediafire.com/file/2mbvsr3skbjdn7l/buttons.xlsx