
Unihiker chattering teeth optimistic news reader with ChatGPT

This UNIHIKER - a tiny Debian Linux board with integrated touch screen - was programmed to get the latest news headlines via RSS feeds.Ā
Ā
Before speaking, OpenAI ChatGPT API rewrites the headlines, but with a twist. ChatGPT is told to rewrite them with a happy, optimistic tone. The response is then fed into Google Translate's text-to-speech API that generates an audio file. The audio file is then played with the help of a Bluetooth speaker. As the audio file is played back, an SG90 servo motor moves a set of plastic chattering teeth to open and close it as if it were reading the headlines for comedic effect.
Ā
Parts required
Ā
   ⢠DFRobot Unihiker SBCĀ
SG90 ServoĀ
  ⢠Bluetooth speakerĀ
  ⢠Optional 3d servo supportĀ
  ⢠Chattering teethĀ
Ā
And some male-male jumper cables.
Ā

Ā
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.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 this 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.
Ā
Software
Ā
Download the Python code from https://github.com/ronibandini/yrigoyenĀ
Ā

Ā
Ā
How does it work
Ā

Ā
Everything should be ready now. Go back to the SSH client and run:
Ā
/home python yrigoyen_en.py
Ā

