Robot Personality Display Add-on

by tekyinblack in Circuits > Robots

47 Views, 2 Favorites, 0 Comments

Robot Personality Display Add-on

IMG_1680.JPEG
Sunshine
Rain
Waving
Hearts
HappySad

This is a fun robot which can run standalone as a bit of fun or as an add-on to a robot design to give it additional personality through visual and audible signals, to make it more informative or fun. It might be particularly useful to children who need a bit more stimulation to gain their interest. The syntax is meant to be simple enough to make it easy for most of us to experiment and achieve results with different designs though younger minds might need a bit of assistance.

A 16x16 dot matrix display provides simple pictures and animations as to how the robot 'feels' , two servos wave arms to give additional waving signals, and a loudspeaker is available to provide sound output to aid communication.

The intention is that the user can easily code their own expressions and display them with commands from a separate robot or from another computer via a serial interface. An example of using a USB interface is shown later. As standalone, it will run a series of actions which can be coded to run continuously.

As described, the project uses 3D printed parts but the builder could make any case and arms they wanted and perhaps just glue the whole together. Static legs for the robot are shown but it could be just as well mounted as the face on a robot project or even a wall.

Pictures displayed are coded in a simple text based 16x16 matrix held in a file and both the display and arms can be controlled from these files.

There are many options for the arms, shown here is one with different sized waving arms, one with ears, and a sun and umbrella for say a weather display, these to be used to give extra expression or to aid getting attention. Others might be a sun and moon on a clock display.

It's based on a Raspberry Pi Pico running Micropython and four MAX7219 driven 8x8 led matrix's, built into a 3D printed case to give the 16x16 array. There are complete 16x16 LED arrays available, manufactured on a single PCB with the MAX7219 but I haven't tested them and they will possibly need the code to be changed slightly to get the pixel addressing correct but will be much easier to connect. Using Python means that this can be included in many current computer education syllabuses'.

The design has been based around a Raspberry Pi Pico, but could be ported to any processor capable of accepting serial input and driving a MAX7219 display chip, and other Raspberry Pi chips such as Pico W, Pico 2 and Pico 2W can be substituted directly.

Control is via a serial interface to issue commands or trigger stored actions held in files, the syntax being the same, but a default file, main.txt, will run from switch-on if defined. A typical file is listed below with explanatory text. Micropython code for the Raspberry Pi Pico is held on github. A variety of display files are attached in the last step and on github.

# Waving Example
# Basic syntax of file
# At the beginning of a line a # sign, blank or anything not a reserved control is ignored
# Display lines are numbered 0-F (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) and can be in any order
# but are only displayed when line F is updated
# '.' or 'X' means start of LED data '.' means OFF, 'X' is ON
# LEFTxxx moves left servo to position xxx
# RIGHTyyy moves right servo to position yyy
# DELAYxxx pauses file read for xxx tenths of a second
# AGAIN closes the file and reopens it, typically the last statement
# CLEAR clears the display of an image
# QUIT exits the running program, mainly for testing
# FILEaaaaa loads display from a file aaaaaa
#
# This example flashes a checkerboard display and waves the arms alternately
# Clear display
CLEAR
# Move left arm to 160 degrees
LEFT160
# Move right arm to 140 degrees
RIGHT140
# Paint display with a checkerboard pattern
#123456789ABCDEF
0.X.X.X.X.X.X.X.X
1X.X.X.X.X.X.X.X.
2.X.X.X.X.X.X.X.X
3X.X.X.X.X.X.X.X.
4.X.X.X.X.X.X.X.X
5X.X.X.X.X.X.X.X.
6.X.X.X.X.X.X.X.X
7X.X.X.X.X.X.X.X.
8.X.X.X.X.X.X.X.X
9X.X.X.X.X.X.X.X.
A.X.X.X.X.X.X.X.X
BX.X.X.X.X.X.X.X.
C.X.X.X.X.X.X.X.X
DX.X.X.X.X.X.X.X.
E.X.X.X.X.X.X.X.X
FX.X.X.X.X.X.X.X.
# wait for 1 second ( 10 x 0.1 seconds)
DELAY10
# Move left arm to 140 degrees
LEFT140
# Move right arm to 160 degrees
RIGHT160
# Invert the display
INVERT
# wait for 1 second ( 10 x 0.1 seconds)
DELAY10
# repeat the file from the beginning
AGAIN


Supplies

IMG_1627.JPEG
IMG_1643.JPEG
IMG_1644.JPEG
IMG_1664.JPEG
IMG_1663.JPEG

4 x MAX7219 based LED matrix displays. These will be connected into a 2x2 square to give a 16x16 display

Raspberry Pi Pico (any version but the Pico 2W will be fastest and will accommodate future web control)

3D printed parts (see Step 1)

3mm nuts and bolts

2 x SG90 or MG90 servos

Dupont connector cables

Small piece of stripboard

PCB pins and sockets

Hookup wire

Buck power convertor

on/off switch

power connector

The following only needed if adding sound:

PCB loudspeaker

1k resistor

S8050 transistor

The following will be needed if controlling over USB (see pictures):

USB cable

USB serial interface

Print the 3D Parts

IMG_1625.JPEG
IMG_1655.JPEG
IMG_1656.JPEG
IMG_1657.JPEG

The parts for this project were printed on a 3D printer and are shown in the pictures, and the design files are attached. They were designed on TinkerCAD. While the parts are printing, the control board can be assembled as shown in the next step.

Because the printed holes can be slightly too small, it may be necessary to drill them out to the correct size of use a round file.

Make the Control Board

Personality_bb.png
Personality Controller Layout v5.png
IMG_1645.JPEG
IMG_1646.JPEG
IMG_1647.JPEG
IMG_1648.JPEG
IMG_1649.JPEG
IMG_1654.JPEG

The control board designed for this project is assembled on stripboard but a commercial board could be used instead though it may not be easily mountable on the main display. The board needs to be able to provide the ability to drive two servo motors, and the MAX7219 ICs via a three pin SPI interface . A Pico is used here, but ESP32 and Arduino could be used, code for these solutions is provided here. Provision is also made for a small loudspeaker.

The control card described can be powered by an external 5V supply directly or by a 7V-12V via the inbuilt buck convertor. If a 5V supply is to be used then the buck convertor socket can be bypassed.

The board has been tested with a USB power supply via the the USB socket on the Pico and found to work ok but the servos might struggle to operate correctly with the limited power.

Assemble the Display

IMG_1632.JPEG
IMG_1633.JPEG

The MAX7219 driven display matrix's should fit into the designed case and it's a good idea to test yours before progressing.

Separate the LED matrix from the PCB, taking a not of the matrix/pcb orientation, and fit the pcbs into the case, attaching them with small M3 nuts and bolts.

Add the Servo Extensions

IMG_1634.JPEG
IMG_1630.JPEG
IMG_1631.JPEG

These can be screwed to the sides of the main display or further secured with nuts on the inside though these may be very fiddly to attach.

Insert the LED Matrix

IMG_1637.JPEG
IMG_1659.JPEG

Fit the LED matrix's into the pcb pin holders, taking care not to bend any pins. It's a good idea to make sure all the pins are straight before beginning.

Add the Servos

IMG_1660.JPEG
IMG_1661.JPEG
IMG_1662.JPEG

Add the servos into their supports and screw them into place with the screws supplied with them. The arms are attached using one of the servo horns cut down as shown in the pictures, and secured in place with the supplied screw.

Before attaching the arms, attach the servos to the control board and run the Zeroarm.py program supplied on github which will rotate the servos to the zero position, which will be arms pointing straight down. The arms can then be attached pointing straight down so that their position is accurately reflected in the display files.

Wiring

IMG_1665.JPEG
IMG_1667.JPEG
IMG_1685.JPEG
IMG_1686.JPEG
Pico Pinout.png

Wiring up is a case of working through the few main connections, and using multiway Dupont cables makes this easier and more reliable. In the pictures above, my wiring is:

VCC Orange

Gnd Yellow

Din Green

CS Blue

Clk Purple

Connect the LED arrays first then run the cable from the first LED array to the control board.

Vcc can be any red pin

Gnd can be any green pin

Din yellow pin 19

CS yellow pin 17

Clk yellow pin 18

The serial and common ground pins are physical pins 2 and 3.

The left and right servo connections are fitted to pins 21 and 22, with the orange/yellow wire over the yellow pin.

Removing the buck power supply before fitting the wires makes this easier.

Load the Code

IMG_1681.JPEG

The code for this project is held on github here and comprises a python program with a couple of libraries and a set of demonstration files.

The program and libraries need to be copied to the Raspberry Pi Pico on the control board, and whichever display files are needed, using a Python development environment.

Renaming the main program as main.py will cause it to be run each time the Pico is rebooted. By default it will attempt to display the contents of the main.txt file but that can be changed in the code.

The display can be arranged to just run itself continuously by just using the AGAIN function or creating a loop of FILEs, chaining from one to the next.

New display files can be created and stored on the Pico but only when the display program is not running, use the QUIT command to stop it before saving to the Pico. The display files are text files and can have any suffix, all the examples use .txt, and can be created in the Python development environment or a basic text editor such as Notepad.

The display can be fully controlled over the serial interface, using the same syntax as files, though commands are only accepted once a display file has completed, so if there are lots of delays it may take a while.

A loudspeaker is included in the design and files for that will be added later.