Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino 101 Bluetooth-Controlled Robotic System with Joystick and Ultrasonic Sensors

View and Edit Project In Cirkit DesignerImage of Arduino 101 Bluetooth-Controlled Robotic System with Joystick and Ultrasonic Sensors

Circuit Documentation

Summary

This circuit involves an Arduino 101 microcontroller interfacing with various components including LEDs, a buzzer, a joystick module, a Bluetooth module, an ultrasonic sensor, and a DC motor driver. The circuit is designed to read joystick inputs, control LEDs and a buzzer, and communicate via Bluetooth. Additionally, it controls DC motors using an L298N motor driver.

Component List

  1. KY-023 Dual Axis Joystick Module

    • Pins: GND, +5V, VRx, VRy, SW
    • Description: A joystick module used to provide analog input for x and y axes.
  2. Arduino 101

    • Pins: A5/SCL, A4/SDA, AREF, GND, D13/SCK, D12/MISO, D11 PWM/MOSI, D10 PWM/SS, D9 PWM, D8, D7, D6 PWM, D5 PWM, D4, D3 PWM, D2, D1/TX, D0/RX, AIN, ioref, RESET, 3V3, 5V, VIN, A0, A1, A2, A3, ICSP MISO, ICSP SCK, ICSP MOSI
    • Description: A microcontroller board used to control the circuit and interface with various components.
  3. LED: Two Pin (red)

    • Pins: cathode, anode
    • Description: A red LED used for visual indication.
  4. LED: Two Pin (yellow)

    • Pins: cathode, anode
    • Description: A yellow LED used for visual indication.
  5. LED: Two Pin (green)

    • Pins: cathode, anode
    • Description: A green LED used for visual indication.
  6. L298N DC Motor Driver

    • Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB
    • Description: A motor driver used to control DC motors.
  7. DC Motor

    • Pins: pin 1, pin 2
    • Description: A DC motor used for mechanical movement.
  8. HC-05 Bluetooth Module

    • Pins: Key, VCC, GND, TXD, RXD, State
    • Description: A Bluetooth module used for wireless communication.
  9. HC-SR04 Ultrasonic Sensor

    • Pins: VCC, TRIG, ECHO, GND
    • Description: An ultrasonic sensor used for distance measurement.
  10. Buzzer

    • Pins: PIN, GND
    • Description: A buzzer used for audio indication.

Wiring Details

KY-023 Dual Axis Joystick Module

Arduino 101

LED: Two Pin (red)

LED: Two Pin (yellow)

LED: Two Pin (green)

L298N DC Motor Driver

DC Motor

HC-05 Bluetooth Module

HC-SR04 Ultrasonic Sensor

Buzzer

Code Documentation

Arduino 101 (Main Controller)

/*
 * Arduino Joystick Controller
 * This code reads values from two KY-023 Dual Axis Joystick Modules and sends
 * the data via Bluetooth using an HC-05 Bluetooth Module. It also controls an
 * LED and a buzzer based on received Bluetooth commands and IR sensor inputs.
 */

#include <SoftwareSerial.h>

#define greenLedPin 8
#define BUZZER_PIN A4
#define ENA_PIN 10
#define IN1_PIN 9
#define IN2_PIN 8
#define IN3_PIN 7
#define IN4_PIN 6
#define ENB_PIN 5

SoftwareSerial btSerial(2, 3); // RX | TX

struct PacketData {
  byte lxAxisValue;
  byte lyAxisValue;
  byte rxAxisValue;
  byte ryAxisValue;
};

PacketData data;
int dataFromSlave = 0;

void setup() {
  pinMode(greenLedPin, OUTPUT);
  digitalWrite(greenLedPin, LOW);
  pinMode(BUZZER_PIN, INPUT);
  digitalWrite(BUZZER_PIN, LOW);
  pinMode(ENA_PIN, OUTPUT);
  pinMode(IN1_PIN, OUTPUT);
  pinMode(IN2_PIN, OUTPUT);
  pinMode(IN3_PIN, OUTPUT);
  pinMode(IN4_PIN, OUTPUT);
  pinMode(ENB_PIN, OUTPUT);
  btSerial.begin(38400);
  Serial.begin(9600);
}

int Joystick(int value, bool reverse)