Technical details

The idea is the following: get the read headlines using RSS, rewrite those headlines with ChatGPT for a happy and optimistic tone, use TTS to create an audio file and finally play the audio file while moving a mechanical mouth.

Due to the software requirements, Raspberry Pi was my first thought but I have received an interesting hardware from DFRobot I wanted to try: the Unihiker.

What is the Unihiker? You can think of it as some sort of Raspberry Pi with an integrated touchscreen. Going in detail, the Unihiker is a Debian SBC with Quad-Core ARM Cortex- A35 1.2GHz, 2.8 colour touchscreen, buttons, WiFi, BlueTooth, mic, light sensor, buzzer, accelerometer, gyroscope and microSD slot. It is my first time with this device, so I’m expecting some obstacles ahead.

Parts required

Software configuration

Connect the Unihiker with a USBC cable to the PC.

Load 10.1.2.3 in the browser

Configure your WiFi SSID and password and obtain the IP of the Unihiker

Now open Putty or some other SSH client and connect to the Unihiker with the IP, user root and password dfrobot

Run the following:

pip install reader

pip install openai

pip install gTTS

pip3 install simpleaudio

Go to https://platform.openai.com/ and sign up for the API. There is a free credit enough for several months of this project. Go to https://platform.openai.com/account/api-keys and create a new secret key.

Open Yrigoyen_en.ino code and enter your OpenAI API key.

openai.api_key = ""

You can edit the OpenAI model:

model_to_use ="text-davinci-003"

The prompt:

prompt = "Rewrite the following news headline with a joyful and optimistic tone:"

The RSS source:

feed_url = "https://www.cbsnews.com/latest/rss/main"

Now connect with Filezilla/ SFTP or any other FTP client using the same IP, user and password as with the SSH client.

Upload yrigoyen_en.py and background.png to /home folder.

Turn on the Bluetooth speaker.

Run the following:

bluetoothctl

default-agent

power on

scan on

pair

trust xx:xx:xx:xx:xx:xx (Device MAC ID)

pair xx:xx:xx:xx:xx:xx (Device ID)

connect xx:xx:xx:xx:xx:xx (Device ID)

You only have to do BlueTooth pairing once. Then it will reconnect automatically.

Hardware configuration

Gpio ports can be accessed using one of the cables provided. Connect the cable to D22 pin on the side of the Unihiker. Connect 3 male to male jumper cables to the Servo respecting the +, - and signal.

Download and print the servo base.

Remove all the inner parts of the jaw and glue the servo arm to the side.

How does it work

Everything should be ready now. Go back to the SSH client and run:

/home python yrigoyen_en.py

/home python yrigoyen_en.py

Small issues with USB connection

In Windows 10 Pro, something related to the USB connection to the Unihiker could cause a Blue Screen. If you face that problem, Unihiker WiFi credentials should be configured again from http://10.1.2.3/pc/network-setting but at this point they will produce a WiFi connection error. Restarting the router and the Unihiker eventually makes the trick.

Demo video

References

Ping pong Python library for the Unihiker https://www.unihiker.com/wiki/pinpong_python_lib

Hipolito Yrigoyen https://en.wikipedia.org/wiki/Hip%C3%B3lito_Yrigoyen

Contact

https://www.instagram.com/ronibandini/ 

https://twitter.com/RoniBandini