Raspberry Pi RSS Feed Text-To-Speech News Box
by mullencn in Circuits > Raspberry Pi
201 Views, 1 Favorites, 0 Comments
Raspberry Pi RSS Feed Text-To-Speech News Box
Supplies
Tools Used:
Laser Cutter
Soldering Iron
Computer (for programming Raspberry Pi)
Hot Glue Gun
Supplies:
Raspberry P 3 A+
Micro SD Card
Adafruit Perma-Proto Board
1/8" Baltic Birch Plywood
1/4" Baltic Birch Plywood
Hamburger Speaker
Potentiometer
16x2 LCD Screen
4x switches
Power Supply
Wire
(Optional: For decoration)
Acrylic Paint
Wood Stain
Depending on how you choose to connect the wires, you may need some pin connectors or wires with pin connectors already installed. If you instead choose to solder everything, then these are not required.
Laser Cut Materials
First, we need to laser cut our materials to assemble our housing. Download the attached .ai files and import them into your laser cutter. Cut the Box out of 1/8" Plywood, and cut the frame out of 1/4".
Set Up the Raspberry Pi
Before we go any further, we need to get our Raspberry Pi set up. For initial setup, follow these video guides from Boston College Information Systems professor John Gallaugher on Youtube. These will take you through the setup process for your device, to install the OS and get it running and updated. Once you have completed this, you will need to execute the following commands in Terminal to install two more libraries:
sudo apt-get install -y libasound2-plugins festival
sudo pip install feedparser
Soldering
Before wiring the device, we will use a perma-proto board to combine our 5V and Ground rails to each only need a single connection from the Pi, as well as connecting to our buttons. First, solder two wires to each button. These should each go to one of the legs on the same side of the button, NOT the same leg on the opposite side (in the guide above, connect it to legs that are NOT Internally connected). One of these should end in a pin connector if attaching to GPIO without soldering, though it does not matter which. Afterwards, we may move on to the perma-proto.
We will be using this to connect our positive and ground wires all together for simplicity. We may begin by attaching the buttons. Locate one of the ground rails (the long rows marked by the negative (-) symbol). Solder a wire to this from each button. If using pin connectors for the pi itself as I did, then you should solder the other wire to this rail. Once these are on, we can attach the wires for the Pi, screen, and potentiometer.
I used pin connectors for each of these components, and will reference the following as such. If you instead choose to solder for any, simply solder the connections in place to the appropriate locations.
We can first continue working with the ground rail. We will need one wire to connect to the pi, one for the potentiometer, and three for the LCD. Prepare the appropriate wires and solder. Next, we may move on to the positive rail (the longer row with the positive (+) symbol). To this rail, we will need to solder one connection to the pi, one to the potentiometer, and two to the lcd. Again, prepare the necessary wires and solder.
As a reminder, you may use either positive and ground rail for these connections, but all connections to a rail must use the same rail.
Assembly and Wiring
Now, we may assemble our device in order to put it all together. Glue the buttons and screen to the appropriate cutouts. Make sure the LCD pins face away from the buttons (towards the top of the box). Once these have been glued, we may connect our wires together.
As a reminder, I’m using and referencing this guide for the use of pin connectors to the GPIO pins. Again, if soldering instead, then replace the pin connectors in the guide with soldered connections.
Use the above guide to connect the LCD to the pins on the Pi and the potentiometer. Once that has been connected, we may attach the buttons. I used the GPIO pins 12, 16, 20, 21, though you could use any other options makers as GPIO, though make sure to make the changes in the coding portion necessary. Make sure your pi is off and unplugged from power while connecting to the pins.
Lastly, with the connections made, glue the rest of the box together. Be sure to test all your cutouts before final assembly. Once that is done, we can move on to getting the device running.
Install the Program
Here, install the downloaded file onto your Raspberry Pi. To do this, either log onto the pi and download it directly, or download it to your computer and install via SSH. Assuming you've installed the necessary additional libraries, and your box is wired correctly, you should be good to go!
The program works by first initializing the screen and buttons on the GPIO pins. If you have changed which pins these are connected to, make the appropriate changes here. Once these have been added and created, it then begins the main loop, where it checks for button presses. It then creates new list variables to store the data we will go through. First, it pulls the RSS feed from whatever URL it is given, and then organizes and appends the first 5 headlines to a list. Then, it takes each of these strings in the list, breaks them up into a series of 16-character strings, and creates a list of all these chunks, each of which is added to a list of lists. It then speaks the news source title aloud and prints it onto the LCD screen, before looping through the lists in order to first speak each headline aloud using Festival, and then displaying each 16-character chunk on the LCD. Afterwards, it will then clear the screen back to just the headline, before looping through this process for each of the 5 headlines.
Downloads
Decorate
Now that it has been assembled, please feel free to decorate your News Box however you see fit. You may consider using wood stain, acrylic paint, a combination of the two, or something else entirely!
You may also attach the frame at this step. Simply line it up where you like on the box itself and glue in place.
I found a combination of paint on the box itself and stain on the frame to give a nice result, but feel free to try whatever you wish!
Test and Enjoy!
Your box is complete! Feel free to test it out, and enjoy your new project!