Bechele2 Info

This page last updated Sept. 25, 2021

Bechele2 is a PERL based animatronic control application that saves servo control data synchronized with MP3 audio file and lets you play them. It can control up to 16 servos (and/or LEDs) using a PCA9685 driver module and streams the audio out of the Raspberry Pi audio interface. It was designed to control the facial movements (eyes, mouth, etc) of a puppet and meant to be triggered by the puppeteer. But it would seem to be a pretty powerful controller for any animatronic project. With Bechele2 you run various scripts that let you program your servo movements in real-time with the audio (with a 50 ms update rate) and play the sound file with the programmed servo movement (or LED brightness) when triggered.

The developer of the software has released it as open source and has also supplied a image file for a Raspberry Pi 3 (and an Orange Pi) that lets you have it setup and running very quickly. It can be a bit confusing to use any animatronic software so I will put together this guide as I start to figure things out. I will update it as I go along but be aware it will be more of a free flowing information document rather than a step by step how-to.

Note that while the Bechele2 apps do have rudimentary graphical user interfaces (GUI) you will need to be comfortable with the Linux command line interface (CLI) in order to launch them and deal with the various files (music and config files). For accessing the programs you will need a SSH client (I recommend Putty) and for accessing the various directories and the configuration file you need a SFTP client (I recommend WinSCP).

The developer of Bechele2 has put together a couple of videos to help get you started. One is for the hardware and one is for the software.


As the application is write in PERL you can probably run it on any platform assuming you can install the required PERL modules (which are all listed in the applications README) . However the developer does have prebuilt images for both a  Raspberry Pi 3 and an Orange Pi. A bit old school but I had a Raspberry Pi 3 kicking around so decided to start with that.

To make testing easier I decide to mount the controller parts on a piece of plywood to keep it all together. I mounted the Raspberry Pi 3, the PCA9685 driver board, an old Cisco router power supply (supplies +5 at 3A and +12 @ 2A),  a old Dell monitor speaker (with amplifier) and wired it all together. I mounted the 5 push buttons on small protoboard and included a small connector for the removable joystick.

I grabbed the Raspberry Pi  image from the developers site and installed it on a SD card using Win32DiskImager. Put the SD into the Pi, connected it via Ethernet to my home network and powered it up. Since I was doing this with no monitor I used an IP scanner (Advanced IP Scanner) to look for the new host once it seemed that the Pi had booted up (once the SD card access LED stopped flashing).  Wasn’t sure what to look for but did see a new host called ‘alarmpi’. Took a note of it’s IP address and connect to it using a SSH client.

You will get a login prompt on the Raspberry Pi. For the username use root and for the password use raspi. You should now have a command prompt.  Assuming you used the image file you can do a  quick test with the build so far by doing the following :

At the prompt type: /home/bechele2/

You should see the following on the screen:

The following MP3 files have been found
The following extra MP3 files have been found
Init ready – program running

Press the NEXT button on your controller. The Old McDonald MP3 sound should play via the Raspberry Pi sound output. To return to the command prompt type: Ctrl – C (Control and C key pressed together).  This confirms you have the basic functionality and now it is time to build a joystick so you can program the servo motion.



In order to program the servo movements in Bechele2 you need to build a joystick. This is a very simple Arduino based circuit that consists of 2 push buttons and a 2 axis joystick. You can pretty much use any of the Arduinos for this (I used a NANO clone) and pretty much any analog joystick. I would avoid the PS2 style joysticks as the Bechele2 author points out, they are not very linear and tend to have a large dead zone in the midpoint. I actually used a analog 3 axis joystick I have previously purchased for another project and just connected the X & Y axis. My joystick had 50K Ohm pots but any value from 10K to 50K Ohms should work fine. I used about 4 feet of 4 conductor shielded cable that I had laying around to connect the joystick to the controller. I used a multipin connector so that the joystick can be removed after programming.

I found the drawings a bit confusing to determine the button labelling (the drawing and code refer to things differently). The push button connected to D2 (called Button1) I labelled as the START button and the push button  connected to D8 (called Button2) I labelled as the STOP button. The original design called for pull-up resistors for the push buttons but I used the internal pull-ups in the Arduinos NANOs ATmega328 processor. I also deleted the extra filter capacitors (but it can not hurt to add them if you want to). I have an updated wiring diagram here and a link to a PDF of it:  Bechele2 Joystick PDF

I also updated the code a bit. First I cleaned up the comments and naming conventions. Then I noted in Rolf’s Arduino code he has some mystery values subtracted from the joystick readings before they are sent to the Raspberry Pi.  I also ran into an issue with the averaging of the joystick pots analog values. The original code does a running average of the reads to avoid jitter. For some reason I wasn’t getting the full range of expected values. I was only getting 0 to 939 rather than the expected 0 to 1023. I updated the code to remove the mystery subtractions and changed the averaging function. Here is a link to my version of the Arduino code for the Joystick: Bechele2_Joystick_2.1 Code

Once you have the joystick built and the Arduino programmed you need to confirm the min/max values for both the X and Y axis. To do this leave your joysticks Arduino connected to your PC with the IDE running (making sure it is not also connected to the Raspberry Pi). Open the Serial Monitor and set the baud rate to 38400 Baud. Enter the number 4 into the upper command window and hit the SEND button. You will get a line of numbers in the monitor window that are updated every time you send the number 4. This will give you the X axis value, Y axis value, Button 1 Status and Button 2 status (Both buttons should show a “1” when not pressed and a ‘0″ when pressed). Move the joystick X axis to its minimal position and note the value (you want to get 0). Move the joystick X axis to its maximum position and note the value (you want to get 1022). Confirm the same for the Y axis. We will need to add these values to the Bechele2 configuration file.

Power Supplies

It is recommended you use separate power supplies for your servos and your Raspberry Pi. This avoids noise and voltage drop caused by the servo current draw (even small servos can take a lot of power to move a mechanism) from affecting the Raspberry Pi. If you do use a single power supply make sure it has enough current capacity.


Servo Information

Before you start playing with animatronics you should get a good understanding about how R/C style servos work and how they are controlled. This will help ensure your projects are successful. A good site for information is:

Bechele2 can work with any R/C style servo but like many things you do get what you pay for in the servo world. In order to learn who to use Bechele2 I recommend you purchase a few decent servos. I like the HiTEC HS-425BB as it is reasonably powerful and is on the quiet side. I’ve only played with analog servos so have no experience with the digital models now available. Try to find a spec sheet for what ever models you do get in order to know the acceptable pulse width (min and max) they support. A standard range is 1.00 ms to 2.00 ms (with 1.5 ms being centered) but it can be a wider range for some servos.

I also strongly recommend you get some sort of servo tester. Make sure it is one that shows the pulse width (in milliseconds) as you adjust it. You can find these on AliExpress or Ebay.  Each model of servo (even different servos of the same model) can react differently to the pulse width control signal so being able to determine the require parameters for control is very important. You will need to know this information for setting the configs in Bechele2 and to also ensure you don’t overload (destroy) your servos (and possible your animatronic mechanisms).

I recommend you setup a few servos on a stand (with just a basic control horn attached to show movement) for initial setup and configuration of Bechele2. Just make sure you have them attached to something so they don’t  start moving when you activate them. It can be as simple as hot gluing them to a piece of wood.


Here are some possibly helpful troubleshooting tips:

PCA9685 Issues

Make sure you have a decent sized power supply for the servos as they can draw a lot of power.

Use the command “i2cdetect -y 1” to scan the I2C bus on your Raspberry Pi.  The default I2C address for the PCA9685 board is 0x40. This must be configured correctly in the configuration file

Switch Wiring Issues

If you are not sure if your switch wiring is correct you can use the “gpio readall” command to display the status of all the GPIO pins. It gives you the status of the various pins at the time you run it. I have also written (actually just edited a script that Rolf had made) a PERL script that will show you the switch status in real time. You can get a copy of the script here: Switch_Test_Script

Simply unzip it and copy to the same folder as the other Bechele2 scripts (usr/local/bin). As you press any of the buttons you get a message confirming it.

Configuration File

The various configuration options are in the file (located at /usr/local/bin/Modules/ You will find a set of default config file templates (for both RaspberryPi and OrangePi) in the the folder in the event you muck yours up. You just need to rename the appropriate one to There are several sections in this file that you will need to edit:

Servo Count – This is the number of servos (from 1 to 16) that you want to control. 

$num_servos=8; # number of servos in use (max 16)

Joystick Limits – These numbers represent to min and max values from the Joystick controller. If you used my joystick code the values should be 0/1022 for each axis. If you used a different joystick you may need to adjust them. Essentially these numbers must equal what your joystick outputs.

$joystick_x_start=0; # The joystick x mechanical start limit value
$joystick_x_end=1022; # The joystick x mechanical end limit value
$joystick_y_start=0; # The joystick y mechanical start limit value
$joystick_y_end=1022; # The joystick y mechanical end limit value

Servo Settings – Each servo has a seperate line in this section for configuring the pulse width (both for the servos complete range and a smaller range to limit movement if required by your animatronics mechanical assembly). Each line has the following sections:

[ServoStartLimit , ServoEndLimit , Invert , ServoStartFull , ServoEndFull , ‘Name’]

ServoStartLimit: Min. pulse width for limited servo range
ServoEndLimit:  Max. pulse width for limited servo range
Invert:  0 = Servo Clockwise, 1 = Servo Counter clockwise
ServoStartFull:  Min. pulse width for full servo range
ServoEndFull:  Max. pulse width for full servo range
Name:  Name for servo

Naturally the values for the fullraneg of your servo depend on the model you use and it’s limits. Below are some typical values with approximate range I got from using them:

180/480 give approx 0.8 mS to 2.2 mS 

200/460 gives approx 0.9 mS to 2.1 mS

220/440 gives approx 1.0 mS to 2.0 mS

To start I would go with the following for each line and then adjust as required:


Controlling LEDs

The PCA9685 used in the Bechele2 controller can also drive LEDs!!. To connect a LED you simply connect the LED across the PWM and GND pins on the PCA9685 board (longer anode lead to PWM and shorter cathode lead to GND). With the LEDs connected this way (source mode) current is limited to 10 mA per pin so no additional current limiting resistor is needed. Then you configure the appropriate line in the Bechele2 config file like this:


With a 50 Hz PWM rate the LED dimming may not appear all that smooth but it is perfect for on/off type operation and makes the Bechele2 control even more versatile. Perfect for making those skull eyeballs glow!!!. If you want to get fancy (and have enough spare pins on the PCA9685 board) you can connect some common cathode RGB LEDs to the pins and be able to adjust the color.

Of course you can also control other devices with the outputs as long as they device can handle being supplied with PWM power and only need 10 mA. If you need to drive a larger load you should be able to connect a N-channel MOSFET low side driver.

Setting It Up Your Animatronic

Now you are ready to connect this up to your animatronic project and start making some sequences. Halloween themed props are great to animate. There is no standard way to make these, essentially try to fit servos inside to make whatever parts can be made to move. Some years ago I found a 2 foot high Santa figure that was going into the trash at work. It had one arm that was moved back and forth by a small AC motor mounted inside and a light bulb in a candle that the Santa was holding. I ended up ripping it all apart and rebuilding it as an animatronic figure. Unfortunately I don’t have any pictures of the process but here is a video showing the mouth movement.  I made the following changes:

  • Replaced the AC motor that moved the arm with a servo to replicate the same motion.
  • Fitted the head on a servo so it can rotate.
  • Cut around the mouth area to make a moving lower lip and chin (somewhat like a ventriloquist’s dummy)  and added a servo to make it move.
  • Added RGB LEDs in the eyes and the candle.

I then fit a power supply and DMX servo controller into the base. I used this animatronic prop several times at Halloween controlled by VSA (Visual Show Automation). I named him “Bad Santa” and had him make scary and sarcastic remarks. Now it was time to make this prop work with  with Bechele2 so I pulled it out of storage and dusted it off.

First I had to remove the DMX controller board as the prop was going to be directly controlled from the PCA9685 board and it was no longer needed. This took a while as I had not ever documented the wiring (I’m trying to make notes for all my projects now) and the base was pretty compact so everything was sort of jammed in.  Once I identified the cables, I was able to extend them out the back opening where the DMX jacks used to mount. I then used some servo extension cables to connect the servos and LEDs to the Bechele2 controller. 

Now come the important part of determining any limits required in your servo motion. When building a prop it is ideal if your mechanism can handle the full range of you servo but this is not always the case. In my Bad Santa prop the arm and the head servos could move across their full motion without jamming (meaning the full pulse width range from 1.00 mS to 2.00 mS so my default servo setting of “220, 440” would work) . However the mouth servo only allowed a much smaller range (it needed a narrower range of 1.50 mS to 1.90 mS).