Check out the upgraded version here!
F3NR1R is a little shoulder-mounted robot based on a fennec fox, one of the most adorable creatures I know. His AI brain consists of a Raspberry Pi 3 with a Neural Compute Stick 2, running OpenVINO. (Here's my guide for setting that up!)
If you like companion bots, check out my original owl familiar, Archimedes!
DesignI chose to laser-cut F3N's pieces, first out of cardboard, because it's much faster than 3D printing pieces, and going into the office is a very rare luxury under quarantine.
I compiled a bunch of pictures of fennecs, and used OnShape, paper, and my trusty mm ruler to draw a few layers that would sandwich the camera and servos in F3N's head. The Assembly tab allows me to place all the layers in space, see how the sizes match up, and adjust the design before sending it to the laser.
The servos are mounted diagonally, so that with a single motor for each ear, I can get the multi-axis movement required to make the ears perky or droopy – a key mode of expression for these little guys. :)
I figured I'd give him three eyes, with the third one being the artificially intelligent camera, but for now I'm just trying to get him up and running with the one. :)
All together, F3N has 13 laser-cut parts: two back legs, two front legs, his torso (tapered toward the back), two parts per ear (to sandwich the servo horns), and four face layers (including the tiny nose nubbin). I might add more nose nubbins to give him a longer snout.
For this prototype, I've used hot glue and double-sided foam tape to attach parts together.
The body is encased in a sleeve cut from an old pair of tights. He'll have a little fox tail as well, which the cables will run through.
Brain: Pi + NCS2F3N's brain is set inside his torso. It consists of a RasPi 3 Model B running Raspbian Buster, connected to a Neural Compute Stick 2 running OpenVINO.
There are a couple more pieces stacked on top, for hardware and audio interfacing. Back in the day, we got these Snips + Seeed Voice Interaction kits, and I never really got to use them before Snips was acquired by Sonos and readied for shutdown. But the hardware setup was beautiful. The ReSpeaker 2-Mics Pi HAT provides stereo microphones, as well as two Seeed Grove expansion ports, a mini speaker, and audio out, so it'll be a snap to add extra functionality: servos, relays, an informational LCD, or anything else I can dream up.
This is going to be a bit hard for me to program, as I'm usually more about the hardware components! But if I can get it working, it'll be a great little platform that could power a huge variety of companion bots.
Motors: Teensy 3.1F3N's ears are regular, absolute-positioning servos, while for his neck, I used a bigger one that turned out to be a continuous-rotation servo. Good practice!
The ear motors are mounted on an angle, roughly 45º, so that you can get some decent fox-ear behavior – pointing upwards, drooping down & out – with a single motor per ear.
I'm using an Arduino-based board to run all the servos, and will have the Pi interface with it over serial. This is consistently an easier way for me to get things up and running, and provides for more modularity – and thus, versatility. :)
I'm working on doing that with an Arduino Nano 33 BLE Sense, which can do its own machine learning with Edge Impulse, but that board doesn't yet consistently run the Servo library well. I'd also like to try it with the SparkFun Artemis Nano, which is another ML-friendly choice.
After a few snafus, though, for now I'm using my old friend the Teensy 3.1 . It's exciting to finally have the ears and head moving around a bit! Below is a test, to make sure the controller and servos were working properly:
Touch sensitivitySince I swapped over to the Teensy, I get a bonus feature: capacitive touch! I've added a piece of Maker Tape running down each leg, and those plug into touch-capable analog pins (A4 and A5).
For each leg, I wrapped the conductive Maker Tape around one end of a hookup wire (see above), then stuck the tape down on the robot, and bent the other end so it could fit into the breadboard next to the Teensy. This tape uses conductive adhesive, so you don't need to be all precious about how you connect it to the hookup wire: just wrap it and go! (I added some masking tape on top of each connection, so that they wouldn't come loose.)
With the Teensy 3.1 (and similar boards), you can simply use the function touchRead(PIN) to read a value off the pin. I'm printing these values to the serial monitor, so I could set a threshold for when each leg is touched. In this case, I've found that the "no touch" value hovers around 1200, and "touch" tends to be around 3700-4500. So, I set the threshold values (threshL & threshR) to 3000.
touchL = touchRead(A4);
Serial.println(touchL);
touchR = touchRead(A5);
Serial.println(touchR);
if (touchL >= threshL) {
Serial.println("touch adjust left");
headLeft();
} else if (touchR >= threshR) {
Serial.println("touch adjust right");
headRight();
} else {
Serial.println("no touch");
headRandom();
}
Here's how I've got it set up, right now:
Adapter boardSince I was trying to figure out which board would be best for the motors (and may yet change my mind), I've used a SparkFun Snappable Protoboard with a mini breadboard on top to create a little adapter for swapping out the Arduino Nano 33 BLE Sense, Teensy 3.1, and/or SparkFun Artemis Nano.
I originally snapped the board so that its pin markings would roughly line up with the properly numbered pins on the Arduino Nano, when the Nano is plugged in (except offset by 10, due to space constraints: pin 12 on the protoboard is pin D2 on the Arduino). Fortunately, this also lines up well with the Teensy's analog pins: pin 12 on the protoboard is pin A2. In both cases, this applies when the USB port is just peeking over the edge of the breadboard, so the first pin on the microcontroller is also the first pin on the breadboard.
I soldered down a row of 11 3-pin connectors for servos (or NeoPixels, if you make a connector). In the images above and below, you can see power and ground wires going to the power and ground "rails" I constructed. This allows me to connect servos on the bottom side, with power routed from its own USB cable, and signal coming from the Arduino pins (those little orange jumpers). There's also a black common-ground wire going from one rail to the Arduino.
It's also easy for me to add other components via the breadboard – such as connecting Maker Tape to the touch pins on the Teensy (see above). I've also spliced a USB cable to the VIN and GND pins on the Teensy. This is so I don't have to have a MicroUSB cable poking out the front of F3N's chest; all three wires (motor power, Teensy power, RPi power) come out as part of the tail.
A small hair tie around the board keeps the various wires in place.
Code / Behavior(See the "Code" section below for the Arduino code.)
I've used a bunch of custom functions to make the motor-control code legible and modular. These include a couple of switching functions, which create random combinations of behavior for F3N's head and ears. It has a little more variety than the code I usually run on Archimedes.
For now, the foxlet responds to touch signals as described above, to control the head; if there is no such signal, it chooses a head tilt option (no tilt, left, right). Then, it picks an option for the ears – pointing, drooping, or twitching the ears, individually or together (as well as "no action").
I'd like to create more complex actions, but for now, it works decently well!
Audio
I've now added a little voice functionality via the ReSpeaker 2-Mics Pi HAT and the Festival text-to-speech engine! It doesn't have a ton of personality yet, but at least it can ask me a question and repeat back the answer!
Setting up the ReSpeaker was really easy – I just followed the wiki instructions. Be warned, though: the speaker is right by the mics, so the test script they give you will create a shrieking audio feedback loop!! I also haven't figured out how to properly adjust the volume yet. 😅
Setting up Festival was pretty easy, too – I followed Adafruit's instructions and am now able to get F3N to talk to me, albeit in a Very Computer Voice. There are a bunch of other voices, as well as the option to use other languages, so I'm hoping I'll find a nicer one!
On the other end, Rhasspy has a few options for offline speech-to-text, or I might end up doing some machine learning. More on that later!
PowerI always try and provide separate power to my robot's brain and servo motors, for a couple of reasons: it's easier to troubleshoot, and I can unplug the motors if I want them to shut up for a second. :)
I like being able to hack on my bots at my desk, connected to wall power, but when I wear them, they need to run off batteries. F3N's brain (the Pi) has power broken out from its 5V and GND pins, because if he had a USB cable sticking out of his side, that would look... rather messy. I used an XT60 connector on the other end of the cable, and put its mating connector on a wall plug capable of 5V/4A for plenty of juice. I also made a USB-A cable with the complementary connector, which I can plug into my high-amperage 5V USB battery for portability.
The rechargeable USB battery has three ports, so can also supply cables directly to the servos and to the Teensy controller, as well as the Pi. It's nice to keep them all separate.
Fun factF3NR1R is named after one of my family dogs. He's a beautiful, floppy terror. :)
Comments