Teletubbies Toy With Real LCD Screen on Its Tummy Playing Real Videos With Sound

by stratosb in Circuits > Raspberry Pi

104 Views, 0 Favorites, 0 Comments

Teletubbies Toy With Real LCD Screen on Its Tummy Playing Real Videos With Sound

1000001242.jpg

Everybody knows teletubbies, the children's television series made for the BBC. The programme focused on four differently coloured characters known as the Teletubbies, named after the television screens on their bellies.

Actually the last characteristic caught my eye and I was pretty sure that there would be teletubbies toys manufactured with real tummy tv screens. However after a quick search on the internet, I couldn't find anything like that. The only thing I could find was this toy with a rewind mechanism resembling a screen: https://www.youtube.com/watch?v=49aYOrBob1Y

So I decided to create, rather transform a teletubbies toy to obtain a screen on its tummy which plays real videos with sound.

Supplies

Find Correct Wiring of the LCD Display to the Pi Zero W

P6070029.JPG
P6070032.JPG
P6070033.JPG

The first step was to find the correct wiring of the LCD display to the raspberry pi zero.

Although there are several websites online for getting this display to work with the raspberry pi zero, I was not able to find the exact match. So after a lot of experimentation I was able to figure out the correct wiring:

Display PIN Pi zero PIN
LED 3.3V (pin 17)
SCK GPIO 11 SCLK (pin 23)
SDA GPIO 10 MOSI (pin 19)
A0 (DC) GPIO 24 (pin 18)
RESET GPIO 25 (pin 22)
CS GPIO 8 CE0 (pin 24)
GND Ground (pin 9)
VCC 3.3V (pin 1)

Install Raspbian OS

raspbian.jpg

You need to install Raspbian Bullseye version, and not the latest Bookwork, on SD Card and update to the latest version. You can find older versions here. This guide from the Raspberry Pi Foundation details all the required steps to install Raspbian on the raspberry pi.

You will need to enable SSH so you can send commands to the pi zero from console without using a monitor (headless mode). Once again there is a helpful guide available provided by the Raspberry Pi Foundation.

You also need to enable SPI on your pi zero. The Serial Peripheral Interface (SPI) is a communication protocol used to transfer data between micro-computers like the raspberry pi and peripheral devices, like sensors and displays. You can do this by using the Raspberry Pi configuration tool:

sudo raspi-config

This will launch the raspi-config utility. Select “Interfacing Options”.

Highlight the “SPI” option and activate “<Select>”.

Select and activate “<Yes>”.

Configure Dtoverlay on Pi Zero W

If you want the raspberry pi to use the LCD display as screen, you need to change the default dtoverlay by editing the config.txt:

sudo nano /boot/config.txt

In there, replace the line which specifies the default dtoverlay with this one:

dtoverlay=adafruit18

and then reboot the raspberry pi for the change to take effect

sudo reboot

Test Configuration

After the restart, if you want to make sure that the new dtoverlay has been applied successfully, you need to check that the appropriate folders have been created by writing the command:

sudo ls /dev

If the following two folders are shown, amongst others, it means that everything went well

fb0
fb1

An additional way is to install fbi, a library to display images on the raspberry pi:

sudo apt -y install fbi

After install, download a demo picture:

wget https://m.media-amazon.com/images/S/aplus-media/vc/6a9569ab-cb8e-46d9-8aea-a7022e58c74a.jpg

and try to view it with the fbi:

fbi -d /dev/fb1 -T 1 -noverbose -a 6a9569ab-cb8e-46d9-8aea-a7022e58c74a.jpg

If the picture of two stools is shown on the display, you are ready for the next step.

Install Software to Play Videos

For playing video, you need to install the mplayer as follows:

sudo apt install mplayer

To make sure that the mplayer plays videos which are shown on the LCD display, download a demo video:

wget http://fredrik.hubbe.net/plugger/test.mpg

and try to play it:

mplayer -vo fbdev2:/dev/fb1 -vf scale=160:128 test.mpg

If you see the video playing on the display, congratulations so far :-)

Setup the Audio

1190151708_max.jpg
IMG_20240619_151538.jpg
1000001196.jpg

Now it is the time to level up the user experience by providing sound to the project. You will use the MAX98357 I2S Class D Amplifier and connect it to the pi zero according to this Adafruit tutorial. The wiring is:

Amplifier PIN Pi zero PIN
Vin 5V Power (pin 1)
GND Ground (pin 6)
DIN GPIO 21 (pin 40)
BCLK GPIO 18 (pin 12)
LRC GPIO 19 (pin 35)

To install the necessary software, you can try the installer script, provided by the same Adafruit tutorial, which makes it easier to set everything up. When you are ready to test the speaker output and you hear no sound from the speaker, without seeing an error on the console, this means that some extra configuration is missing. I have detailed the steps in this video that I have created, but what you need to do is:

sudo nano /etc/modules

add the following text:

spi-bcm2835

and reboot for changes to take effect. After that you will hear sound from the speaker.

Test the Python Script

Teletubbies Toy With Real LCD Screen on Its Tummy Playing Real Videos With Sound

Normally the teletubbies toy, if manufactured by a company, would contain a number of preselected videos that you can play. However for our toy, you will be able to play any video you want from youtube. For this reason, I have a created a python script, with which you can send youtube videos to the raspberry pi remotely and play them on the LCD screen.

First you need to install PyTube, a python library for downloading youtube videos in the raspberry pi:

sudo pip3 install pytube

Then download the python script from my github repository:

wget https://raw.githubusercontent.com/stratosb/stream_video/master/stream_video.py

Now it is time to run the script:

sudo python3 stream_video.py

When you run the script, it should start the server and wait for a connection from another device on the network. This means that you must know the local ip of the raspberry pi, because you need to type this ip in your browser from any device on your local network.

But first you need to search youtube and find the url of a teletubbies video you want to play, for example:

https://www.youtube.com/watch?v=IMw9QhTftIo

Take the video identifier:

IMw9QhTftIo

Open a browser from another device on your local network, type the local ip of the raspberry pi and then add the video indentifier, like this:

http://192.168.2.2/IMw9QhTftIo

Replace the above ip with the one of your raspberry pi.

The script will now grab the youtube video and download it locally to the pi. After it's done downloading, it will automatically start playing the video. Be aware that some videos can take a while to download, but once you download them, you don't have to do it again.

Fitting It All Together

1000001194.jpg
1000001200.jpg
1000001202.jpg
1000001241.jpg

Now that everything seems to be working, its time to fit it all together!

The toy has plenty of empty room inside it so you can manage to fit all components together.

The end product is what you see at the photos.

The next phase would be to make the teletubbies toy fully portable by attaching batteries to power up the raspberry pi.

Enjoy!

1000001243.jpg

If you enjoyed this guide and gave you some ideas for your next project, please favourite it and subscribe to my youtube channel for more projects like this. Thank you.