Remote Controller for DIY Robots

by danielgass in Circuits > Microcontrollers

276 Views, 5 Favorites, 0 Comments

Remote Controller for DIY Robots

1a.png

A small universal remote controller to drive robots via Bluetooth.

Features:

Small size for easy handling.

Use of the Raspberry Pico module.

Programming in micro-python language with Thonny editor.

Powered by a 18650 battery.

Bluetooth operation

Use of joystick and pushbuttons.

Simple program adaptable to different robots.

 

In this project, the remote control is used to drive the articulated arm already published on this site.

Functional Description

2a.png
2b.png
2c.png

This remote control is used in conjunction with the articulated arm project (https://www.instructables.com/Automation-of-an-Articulated-Arm-With-Raspberry-Pi/).

It replaces smartphone control. We'll find out in the programming section that it can be adapted to a multitude of projects.

Control is by sending a character to the articulated arm. Each character received by the arm is transformed in an action.

There are two sets of commands.

Commands with individual actions on each servomotor.

Commands that use a memory to store and retrieve action sequences.

The remote control has 10 pushbuttons. The black button switches between the two sets of commands.

Components and Assembly Description

3b.png
3c.png

The schematic is simple and uses few components.

The Raspberry Pico controller, with its numerus inputs including ADCs, is ideal. I used a Pico W controller, as I didn't have a simple controller on hand.

The power supply (A) is provided by an 18650 battery and a DC-DC converter to 5V. A diode protects the converter when using the USB connection.

The joystick (B) connects to two ADC inputs for voltage-based angle measurement.

10 pushbuttons (E) and a toggle button (F) can be used to send up to 20 codes.

The HC05 Bluetooth module (G) is connected to the UART0 input. Programming in master mode is described below.

Two LEDs (C) (F) complete the set to monitor Bluetooth communication and push-button control.

You can download the project files here.

Programming HC05/HC06 Modules

4a.png
4b.png

Pairing Bluetooth modules

This simple micro-Python program (config bluetooth.py) allows you to easily configure master and slave modules.

Lines 9 to 17: AT commands for reading information.

Lines 19 to 26: AT commands for writing information.

Lines 28 to 36: The function that sends the AT command as an argument and displays the result.

Lines 39 to 40: Displays information about the module by sending several AT commands.

Lines 41 to 42: Program the module as required, using AT commands (lines 19 to 26).

Lines 43 to 44: Displays information about the module by sending several AT commands.

An example of configuration is shown on the picture with the parameters to be set. (pswd, role and bind).

To put the module in AT mode, connect the "enable" pin to 3.3V before powering up.

To test pairing, power up both modules as shown on the picture. After a few seconds, both modules will flash every five seconds, as shown in the diagram.)

Programming

5a.png
5b.png
5c.png

The micro-python program for the remote control is not complicated.

Declarations:

Lines 12 and 13 contain lists of GP ports used. One list by pushbutton column

The tables on lines 15 to 22 contain the values to be transmitted according to the pushbutton used.

Using tables makes programming easier. We work by key column indexed from 0 to 4 for servos 1 to 5.

Program sequence:

Lines 37 to 40: read the vertical position of the joystick.

Line 32: Checks whether black button (secondary function) or joystick is pressed.

Lines 44 to 46: Secondary functions are selected. Search for the value corresponding to the button pressed. The "repeat_ind" variable is set to 0. The push-button value will be sent only once, even if the key is kept pressed.

Lines 47 to 54: Alternatively, we also search for the pushbutton used and the position of the joystick. The "repeat_ind" variable is set to 1. The push-button value will be sent regularly when the key is held down.

Lines 57 to 63: Conditional transmission of the value to the Bluetooth module. Condition to be fulfilled:

A character is to be sent (send_val != ' ').

That the key used is a repeat key.

 

To work with the articulated arm, use the modified program contained in downloads.

Conclusion

With its relatively simple program, this remote control is designed for multiple use. With a few modifications, you can extend its field of activity. For example, you can increase the size of the string to be sent. In this way, the exact position of the joystick can also be transmitted as a character string.

 

Now you can let your imagination run wild with your robot projects. Make the most of it!