Introduction: Raspberry Pi Twitter Candy Bot
Video of all steps at a high level
- Raspberry Pi (If this is your first time you may also need monitor, keyboard, and mouse)
- WiFi Adapter or Ethernet cable
- Wires with female plugs for connecting to Raspberry PiCandyPlastic pop-bottle or similar container.
Step 1: Setup Raspberry Pi With Rasbian
If you have not used a raspberry pi before please see the Raspberry Pi website: http://www.raspberrypi.org/help/quick-start-guide/
If you have your raspberry pi up and running with Rasbian skip this step.
Step 2: Setup NodeJS on Your Raspberry Pi
WeWorkWePlay has a great tutorial for this:
Step 3: Setup WiFi on Raspberry Pi Startup
If you want to use wifi, then you will need to setup your raspberry pi to connect automatically when it starts up.
You will need to edit /etc/network/interface to include the name and password for your wireless network.
Step 4: Setup the Candy-bot Code
Download or Fork it from GitHub: https://github.com/davidrs/candy-pi
Save it to your Raspberry Pi: /home/pi/candy-pi
Create a developer account for the Twitter API: https://apps.twitter.com/
On the Twitter App site add a new app and generate an API key.
Update the config.js with your Twitter API key.
Test locally: `npm index`
Setup your Raspberry Pi to run the code on startup. (see tutorial in step 2 for details)
Step 5: Connect Servo
Last step is to wire up your servo.
This will vary servo to servo, but roughly, you will have three wires positive, negative(ground), and control signal.
On my servo it is:
Brown - ground
Red - positive
Orange - control (I used GPIO pin 4)
For small servos you can run it off the Raspi 5v pin for positive and the Raspi ground, but best practice is to use an independent power source, such as batteries or a wall plug. For the control wire you plug it into the pin specified in hardware.js in the code. default is pin 4.