Fibromatic

Introduction: Fibromatic

Fibromatic is an automatic feathering massage for Fibromyalgia patients using Arduino, RPi and a Robotic arm.

Background story is that my sister has Fibromyalgia for several years now and about a year ago she came to me with an idea for an apparatus that mechanically pleasently moves a feather on her back. At first I had no idea how to implement such a device despite I do have (unofficial) background in electronics, but about a couple of months ago I thought to craft such thing with a robotic arm which has become cheap and affordable, and that's what I did.

The project is heavily based on an existing product - 5DOF Robotic Arm by Adeept - which uses Arduino as the underlying driver for the servos. We will add to that a Raspberry Pi Zero W (which I'll call RPi from here on) as a webserver (NodeJS) to allow convenient control over the robotic arm from your mobile phone. I am now trying different types of robotic arms but the instructions (pinout, boards) will assume this specific model.

As Adeept supply a well documented instruction guide for building the Robotic Arm itself, this instructable will focus on configuring the RPi as a web server that controls the robotic arm through serial.

This instructable will assume you are using a Windows OS as your primary OS.

Remaks: currently the Web UI is in Hebrew (but of course this can be easily changed)

Supplies

List of suggested parts (prices and shipment may vary):

  • 1 Robotic Arm - From Adeept (costs: 60-70$)
  • 1 Raspberry Pi Zero W - You can get it from many places, here is an Amazon link as an example (10$-30$)
  • 1 Class 10 microSD 32/64GB - This can also be purchaced from many places, here is an Amazon link as an example. Make sure it's Class 10 (~10$)
  • Strong USB Charger - at least 30W (example, ~4$)
  • 1 Wooden stick - ~1$
  • 1 Pleasent to the touch feather - ~2$-10$, depending on the quality
  • 3 Female to Female Jump Wire Cables (Example)
  • USB SD Card Reader

Step 1: Build the Robotic Arm

Follow Adeept's instructions on building the Robotic Arm which should be located here.

It might take you couple of hours, depending on your skills.

The instruction Adeept supply are very thorough and includes elaborated steps on how to install the Arduino IDE and how to build the actual arm.

Make sure to build the 3DOF version of the Robotic Arm (what they call "Play1") which uses the pencil placeholder (as shown in the picture above), and not the machanical fingers, since it holds the feather better.

After you complete, play with their pre-supplied Arduino sketches to see that it works properly until you are comfortable with it. I like to test it using the built-in potentiometers, each one controls a different dimention of the arm.

Step 2: Configuring Headless RaspberryPi Zero W - Overview

The Raspberry Pi Zero W has WiFi capabilities and our goal is to configure it without connecting a keyboard and a monitor, so when its first connected to power, we will be able to connect to it over WiFi from our PC.

We will do it in several steps:

  • Downloading Raspberry Pi OS image
  • Writing the image to the SD Card
  • Pre-configuring WiFi and SSH by manipulating the SD Card files
  • Putting the SD Card inside the RPi and supplying power
  • Connecting to the RPi through SSH using Putty (Windows) and continuing configuration

Step 3: Downloading Raspberry Pi OS Image

Go to https://www.raspberrypi.org/downloads/ and download "Raspberry Pi OS" (not NOOBS):

From the same website, also download the Raspberry Pi Imager for Windows and run it.

Step 4: Writing the Image to the SD Card

Click "CHOOSE OS", and select the Raspberry Pi OS file you downloaded and unzipped.

Insert the SD Card to your computer (either you already have an SD Card reader in your laptop or you will need a USB SD Card reader)

Click "CHOOSE SD CARD" and select the SD Card connected to your computer.

Now click "Write" and wait until it's finished copying and verifying the image.

Step 5: Pre-configuring WiFi and SSH by Manipulating the SD Card Files

Eject and re-insert the SD card to your PC's card reader. You should be able to see now it has a Boot folder on it.

SSH

Place an empty file called "ssh." (yes, no extension) inside the Boot folder (you can use Notepad for that, just don't forget to remove the ".txt" suffix). See Step 3 here.

WiFi

Place a file called "wpa_supplicant.conf" inside the Boot folder, which will have the following content:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

update_config=1

country=<Insert 2 letter ISO 3166-1 country code here>

network={
 ssid="<Name of your wireless LAN>"
 psk="<Password for your wireless LAN>"
}
<br>
Replace the text "Insert 2 letter ISO..." with your 2 letters country code from this Wikipedia link

Replace the text "" with the name of your wireless LAN, same goes for the password.

Step 6: Putting the SD Card Inside the RPi and Supplying Power

Connect your Mirco USB charger to the RPi. That will start it up.

Let it run for a couple of minutes and do its thing. You will have an indication that it's working when you'll see the green led flashes on and off on the RPi.

Step 7: Connecting to the RPi Through SSH Using Putty

Download Putty (SSH client for windows). It's free.

When the RPi start up, it registers its hostname with your home router. The default name is raspberrypi. We will use this property in order to connect to it without knowing its IP address inside WLAN.

Open Putty and enter raspberrypi in the Host Name field (see first image of this step).

Then click "Open". You should get a "Putty Security Alert" Window (see second image of this step).

Click "Yes".

A black terminal window will ask you for the username and password, use:

Username: pi
Password: raspberry

(See third image of this step).

And that's it, we're in like flynn :)

Please update packages:

sudo apt-get update

Important Note: we are currently using the default password for ssh login which is a great security hazard. In order to harden security, change the default password and use Private/Public key pair to connect using Putty instead of a password

Step 8: Installing NodeJS 14 on the RPi

Since we want to install NodeJS version 14, which does not have an offical build for Arm - the CPU that RPi uses - I will point to the NodeJS Unofficial Builds page.

We will use this link for NodeJS version 14.13.1 and will download this file called node-v14.13.1-linux-armv6l.tar.gz, so in your Putty console type:

cd /tmp

wget https://unofficial-builds.nodejs.org/download/release/v14.13.1/node-v14.13.1-linux-armv6l.tar.gz

tar -xzvf node-v14.13.1-linux-armv6l.tar.gz

sudo mkdir /usr/local/lib/node

sudo mv node-v14.13.1-linux-armv6l /usr/local/lib/node/nodejs

echo export NODEJS_HOME=/usr/local/lib/node/nodejs >> ~/.profile

echo export PATH=/usr/local/lib/node/nodejs/bin:$PATH >> ~/.profile

. ~/.profile

Make sure we installed it OK by running node -v:

pi@raspberrypi:/tmp $ node -v

v14.13.1

Step 9: Enable RPi Zero W Mini UART

In order for the RPi to communicate with the Arduino, we will use it's built-in Mini UART that needs to be enabled.

Run the following commands in Putty:

sudo -s

echo "enable_uart=1" >> /boot/config.txt

systemctl stop serial-getty@ttyS0.service

systemctl disable serial-getty@ttyS0.service

sed -i 's/console=serial0,115200//g' /boot/cmdline.txt

reboot now

Now we will wait for 1-2 minutes for the RPi to reboot. The Putty session will disconnect (displaying an error message "Remote side unexpectedly closed network connection"). You can right click on the Putty terminal chrome and select "Restart Session" from the context menu, or just connect normally as we did in Step 7.

To verify that Mini UART was enabled properly, run the following command in the newly established Putty session:

echo "Hello" > /dev/ttyS0

If you don't get an "Permission Denied" error, we're good to go :)

Step 10: Download and Setup Firbomatic Website

We will pull and setup the NodeJS code I wrote for Fibromatic UI.

Enter the following in Putty terminal:

cd ~/

git clone https://github.com/omeriko9/fibromatic

mv fibromatic/fibrorpi/ fibrorpi

rm -rf fibromatic/

Next thing we need to do is to install NPM packages:

cd fibrorpi

npm install

This might take a while.

Now let's verify that node can run it properly:

node start.js

The output should look something like:

pi@raspberrypi:~/fibrorpi $ node start.js

Express is running on port 3000

Step 11: Verify Website Is On

Go to another PC or mobile phone in the same WiFi network and enter the following URL in the browser:

http://raspberrypi:3000

You should seesomething similar to the image attached to this step. If not, check for errors in the Putty terminals and make sure you followed properly all the steps up to this one.

Step 12: Start NodeJS Automatically After Reboot

In order for the website to be available after every reboot, we will use a NPM package called P2.

Enter the following commands:

cd ~/fibrorpi
npm install -g pm2
pm2 start start.js
pm2 startup 

That's it! now the NodeJS webserver will start automatically on every boot.

Step 13: Connect RPi and Arduino

Now it's time to make the connection between the Arduino and the RPi.

For that we will use 3 female to female jump wire cables.

Connections are (see first image of this step for more details):

Pin 4 (5V) -> Arduino 5V

Pin 6 (GND) -> Arduino GND

Pin 8 (GPIO14 UART0_TXD) -> Arduino Pin 10

Step 14: Upload the Arduino Code to the Arduino

Make sure your Adeept ARM Board is connected using the supplied Micro USB cable to a PC where you already downloaded (as per the instructions that comes with the robotic arm) the Arduino IDE.

Now, from your PC, download the Fibromatic Github project zip file, unzip it, and open the ArduinoCode/main/main.ino file in your Arduino IDE.

Compile & Upload the code to the Adeept ARM Board.

That's it, the robotic arm is now controlled by the RPi web interface! :)

Step 15: Make the Wooden Stick

This step is pretty personal, you can attach any kind of feather until you find the right one.

I used a narrow long cylinder wooden stick and connected a feather my sister already had with scotch tape (see picture).

Step 16: Enjoy Your Fibromatic!

Position the Fibromatic next to your bed (see image), lay on it and use your mobile phone to access the web interface (reminder: located at http://raspberrypi:3000), and enjoy the pleasent feathered massage! :)

Step 17: Optional: Change RPI's Hostname

You might want to change RPi's hostname, effectively changing the URL to connect to the web interface.

This can be done, again, with raspi-config:

sudo raspi-config

Select 2 Network Options

Select N1 Hostname

Enter a new hostname, for example: fibro

Click Finish

When asked if you want to reboot, select Yes

Now, when the RPi boots, you can access your fibromatic web interface using the following address:

http://fibro:3000

Step 18: Optional: Make the RPi Upload the Arduino Sketch

You might want to deep dive into the Arduino sketch and the protocol used between the RPi and the Arduino in order to adjust the code for your needs.

For example, after I installed the apparatus in my sister's home, she wanted something to be changed in one of the programs. Since the programs are part of the Arduino code, having the RPi compile and upload code to the Arduino will enable such adjustments from remote, as long as you can connect to the RPi using SSH over Internet.

Be the First to Share

    Recommendations

    • Micro:bit Contest

      Micro:bit Contest
    • Made with Math Contest

      Made with Math Contest
    • Robots Contest

      Robots Contest

    Comments

    0
    Alex in NZ
    Alex in NZ

    1 year ago

    This is brilliant! I was looking for something like this to provide stimulus while nerves regrew on an area of my leg. I recovered before I was able do anything about it, but this is just exactly what I would wish I'd been able to make. Thank you for sharing your work, and I hope that it provides relief.