Project tutorial

"Winkable" DIY Smiling Wireless Robot

Cute little DIY project using 8x8 LED matrix module and nRF24L01.

  • 251 views
  • 0 comments
  • 4 respects

Components and supplies

Apps and online services

About this project

What is this robot?

This robot is a cute little cube that has two wheels stick out from two sides. By using NRF24l01+ BLE module, we can wirelessly control it. Both the robot and the controller are made from recyclable materials that you can find at home! We can make the emoji aka the "face" of the robot by using the 8x8 matrix module called MAX7219 Module.

The robot.

Things you need to have:

  • Arduino Uno
  • Prototyping Shield (Optional)
  • MAX7219 8x8 Matrix Module
  • Two 360 Servos with wheels designated for servo
  • 12V DC Battery Power Supply
  • Piezo Buzzer
  • NRF24l01+ BLE Module
  • Batteries
  • Jumper Wires
  • Cardboard or foam or wood or whatever material you wish to make your robot with

Constructing phase:

Here, I constructed the base with thin wood and use the glue gun to stick the part together. Glue the servos on the two sides in which you wish the wheels to stick out. Then adjust the wires so that only the tops of the wires stick out of the lid. Remember which tops of wires go to which servos.

Then, I glue the Arduino on the wooden top with the prototyping shield attached on it. You can use breadboard or something else as you wish, but the shield works best for me.

Somehow, the 8x8 Matrix Module that I use doesn't fit if I put it the regular way (top down). So I put it upside down, and it fits perfectly. (The code I used is adjusted for the upside down version of the robot. Unless you want the use the matrix the normal way, I recommend using the code down below for the robot.)

Attach jumper wires to connect the Arduino with the Matrix Module, Servos, Buzzer, NRF24l01+ as in the following image:

The Controller

Whatyou'llneed:

  • Arduino Nano R3
  • Mini Breadboard
  • NRF24l01+
  • Joystick
  • Whatever material you may wish to make the controller from.

Constructingphase:

The handle is actually made of the cardboard tube, or the innermost cardboard thing, of the toilet paper roll. I bet you've had it a lot but have recycled them all! Anyways, the idea is that you stick the joystick on top of the handle, and the Arduino as well as the BLE module at the bottom. The hard part is to fit all the jumper wires and all those thing in such a small place.

Anyways, picture-to-picture tutorial is down below if you want to check it!

The image in which I make to keep track of the wiring stuff is down below:

Videos:

Code

RobotC/C++
#include <LedControl.h>
#include <Servo.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include "binary.h"

LedControl lc = LedControl(6,5,4,1); //DIN,CLK,CS
RF24 radio(7,8);
const byte address[6] = "00001";
Servo left;
Servo right;
int joy[3]={90,90,1};
unsigned long last=0;
int a=1;
unsigned long timePress=0;
unsigned long lastPress = 0;
unsigned long blinkInterval=4000;

byte up_face_norm = B00100100;
byte up_face_blink[4] = {B00000000, B00100100, B01011010, B00000000};
byte low_face_norm[4] = {B00000000, B01000010, B01000010, B00111100};
byte low_face_laugh[4] = {B00000000, B01111110, B01111110, B00111100};
byte heart_hollow[8] = {B00000000, B01100110, B10011001, B10000001, B10000001, B01000010, B00100100, B00011000};
byte heart_full[8] = {B00000000, B01100110, B11111111, B11111111, B11111111, B01111110, B00111100, B00011000};

void setup() {  
  left.attach(10);
  right.attach(3);
  Serial.begin(9600);
  lc.shutdown(0, false);
  lc.setIntensity(0,2);
  lc.clearDisplay(0);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
}

void loop() {
  unsigned long current = millis();
  if(a%3==0){
    lc.shutdown(0,true);
    if(joy[2]==0){
      timePress = millis();
      if((int)(timePress-lastPress)>=50&&(int)(timePress-lastPress)<=200){
        a++;  
      }
      lastPress = timePress;
      tone(2,10);
    }else if(joy[2]==1){
      noTone(2);
    }
  }else if(a%3==1){
  lc.shutdown(0,false);
    if((unsigned long)(current - last) >= blinkInterval){
      lc.clearDisplay(0);
      lowerFace();
      for(int j = 0; j<4; j++){
        lc.setColumn(0,j,up_face_blink[j]);
        delay(10);
      }
      last = millis();
    }else{
      for(int i = 0; i<4; i++){
        lc.setColumn(0, i, up_face_norm);
      }
    lowerFace();
    }
  }else{  
    heart();  
  }
  if(radio.available()){
    radio.read(&joy, sizeof(joy));
    int x = abs(map(joy[0]-joy[1],-1023/2,1023/2,0,180));
    int y = abs(map(joy[0]+joy[1],1023/2,1023*3/2,180,0));
    right.write(x<=100&&x>=80?90:x);
    left.write(y<=100&&y>=80?90:y);
  }
}
void heart(){
  if(joy[2]==0){
    timePress = millis();
    if((int)(timePress-lastPress)>=50&&(int)(timePress-lastPress)<=200){
      a++;  
    }
    lastPress = timePress;
    for(int j = 0; j<8; j++){
      lc.setColumn(0,j,heart_full[j]); 
    }
    tone(2,10); 
  }else if(joy[2]==1){
    for(int i = 0; i<8; i++){
      lc.setColumn(0,i,heart_hollow[i]);
    }
    noTone(2);
  }  
}
void lowerFace(){
  if(joy[2]==0){
    timePress = millis();
    if((int)(timePress-lastPress)>=50&&(int)(timePress-lastPress)<=200){
      a++;  
    }
    lastPress = timePress;
    for(int i = 0; i<4; i++){
      lc.setColumn(0, 7-i, low_face_laugh[3-i]);
    }
    tone(2,10);
  }else if(joy[2]==1){
    for(int j = 0; j<4; j++){
      lc.setColumn(0, 7-j, low_face_norm[3-j]);
    }
    noTone(2);
  }
}
ControllerC/C++
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(7, 8); // CE, CSN
const byte addresses[6] = "00001";

void setup() {
  Serial.begin(9600);
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
  pinMode(2, INPUT_PULLUP); 
  radio.begin();
  radio.openWritingPipe(addresses); 
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}
void loop() {
  int joy[3] = {analogRead(A0),analogRead(A1),digitalRead(2)};
  radio.write(&joy, sizeof(joy));
    Serial.print(abs(map(joy[0]-joy[1],-1023/2,1023/2,0,180)));
    Serial.print("  ");
    Serial.println(abs(map(joy[0]+joy[1],1023/2,1023*3/2,180,0)));
}

Comments

Similar projects you might like

4-Wheel Robot Made With Arduino Controlled Using Dabble

Project tutorial by STEMpedia

  • 8,512 views
  • 8 comments
  • 27 respects

Make a Wi-Fi Controlled Simple Robot Using Arduino

Project tutorial by rajitha_kumara

  • 7,848 views
  • 1 comment
  • 7 respects

MeArm Robot Arm - Your Robot - V1.0

Project tutorial by Benjamin Gray

  • 29,120 views
  • 4 comments
  • 41 respects

Simple Gesture Controlled Robot Using Arduino

Project tutorial by Jithin Sanal

  • 6,815 views
  • 1 comment
  • 26 respects

Arduino-Powered Robot Controlled with The Tactigon

Project tutorial by Team the tactigon team

  • 4,518 views
  • 0 comments
  • 21 respects

Arduino Controlled Delta Robot

Project showcase by geordag

  • 3,713 views
  • 2 comments
  • 12 respects
Add projectSign up / Login