Software: Installing Emulation Software

This time I’m going to start with Atari 800 as my emulator…older games.

So on the Desktop, I went “Menu”, then “Internet” then “Pi Store”, then browsed through until I found “Atari800″.

Software: Initial Setup

I’m getting the software going first before I mess with the cabinet.

I’m starting out with a fresh 8GB SD card (only class 4 as that was the cheapest one I could find…doubt it makes a difference considering the size of the ROMs and what-not).

  1. Downloaded the freshest version of Noobs, and went through the initial setup menu to boot to desktop.
  2. Gave my Pi a static IP address
  3. Enabled SSH
  4. Installed tightvncserver by “sudo apt-get tightvncserver”
  5. Rebooted

Note: Steps 2-4 allow me to remotely access the Pi for easier tinkering. From here you just use a program like Putty to start VNC (I don’t keep it on all the time just as its one more thing that won’t need to be running once everything is working properly), then using a program like tightvncviewer  to see the Pi’s desktop.

Raspberry Pi Video Game Console v2

I’ve decided to build a full desktop-arcade cabinet. Got half the parts already so I figure I’ll give it a start.  I’m shelving my window blind controller for the moment.

Hardware: config with reset wire

Here’s the wire – the blue one from pin 12 to reset pin.

Untitled-1

Jitter Problem ‘fixed’

So here’s my code now and I think I’ve fixed the jitter. As noted in the prior post, I moved the servo attachment down into the loop so that it doesn’t attach until a button is hit (so no jitter before then). I’ve also added a couple lines and a wire so it reboots after the servo moves (which stops the jitter of course). Considering I’ll only be using this a couple times a day at most, I think that works. I think the real solution would be to get a separate servo controller, but I’m happy with my work-around. So far it seems to work really well. I haven’t really fixed the jitter problem…just made it so that it jitters for an acceptably short period.

#include <Servo.h>
#include <IRremote.h>

unsigned long Value2 = 0x7B8; // RED button where 7B8 is your remote button’s values.
unsigned long Value1 = 0x78B; // YELLOW button where 78B is another button on your remote

int RECV_PIN = 3;// initialize the digital pin as an output.
int resetPin = 12;// initialize the digital pin as an output.
IRrecv irrecv(RECV_PIN);
decode_results results;

Servo servo1;
Servo servo2;

void setup() {   // put your setup code here, to run once:
digitalWrite(resetPin, HIGH);
delay(200);
pinMode(resetPin, OUTPUT);
Serial.begin(9600); // initialize the serial port
Serial.println(“reset”);//print reset to know the program has been reset
delay(200);
irrecv.enableIRIn(); // Start the receiver
}

void loop() {  // put your main code here, to run repeatedly:

if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}

if(results.value == Value1) {
servo1.attach(9); // attach servo to digital pin 9
servo1.write(5); // move to 5 degrees
delay(5000); // 5 sec delay to let motor move
digitalWrite(resetPin, LOW);//restarts board
}

if(results.value == Value2) {
servo1.attach(9); // attach servo to digital pin 9
servo1.write(175); // move to 175 degrees
delay(5000); // 5 sec delay to let motor move
digitalWrite(resetPin, LOW);//restarts board
}

}

Jitter Problems

Still having jitter problems. I’ve tried all sorts of capacitor sizes and configurations trying to fix the problem but it doesn’t work.  My only significant progress is that I moved the servo attachment into the  individual ‘if’ statements so that the jitter doesn’t start until I actually hit a IR remote button. When I had the servo attachment at the beginning of the loop,  the servo would start jittering as soon as the Arduino powered up.  I think I can still figure out some kind of software solution by powering down the 5v power and restarting, but my attempts so far haven’t been successful.

still working on it.

Hardware: bad servo

Well, it looks like the micro servo is bad. For whatever reason, it doesn’t work right with the same sketch that I’m using on the bigger one…not only that but if I run the template “Sweep” program, it only turns about 90ish degrees, vs. the 180ish degrees that the big servo turns.

So I’m at a pause till I get either the capacitors or another servo.

BTW, Adafruit was super responsive on their forum and getting an RMA# was very painless…Thanks Adafruit!

Hardware: Second Servo Connection

While I’m waiting for my capacitors, I figure I’ll go ahead and connect the second servo to try to get both working at the same time. Considering each servo needs the majority of the juice coming out of the Arduino, I’m hoping to stagger them so that when I hit the remote button, servo one will move, THEN servo two, etc (so not all at the same time as I’m pretty sure this would be too much of a power drain).  Here’s how I have servo two set up:

2 servo

Software: Controlling the first Servo (jitter problems)

I’m referencing this site again. Here’s the code I’m using:

#include <Servo.h>
#include <IRremote.h>

unsigned long Value2 = 0x7B8; // RED button where 7B8 is on our your remote’s values.
unsigned long Value1 = 0x78B; // YELLOW button where 78B is another button on your remote

int RECV_PIN = 3;
IRrecv irrecv(RECV_PIN);
decode_results results;
 
 
Servo servo1;

// the setup routine runs once when you press reset:
void setup() {              

Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver

  // initialize the digital pin as an output.

servo1.attach(12); // attach servo to digital pin 12
}
// the loop routine runs over and over again forever:
void loop() {

if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }

if(results.value == Value1) {
servo1.write(2);
}

if(results.value == Value2) {
servo1.write(178);
}

}

Note that it still has the code to continue to print the hex values.

If you look at the site and compare it to my code, you’ll note there’s a typo on the site when it references Value1 and Value2 at the bottom of the code (site references Value1 both times).

And it works!  one button turns it one way, and the other button turns it the other way.

The only problem I’m having is that there’s significant jitter that I know it would bug me. I’ve Googled around it likes like an issue with the Arduino’s timer (above my head really). I tried the smaller servo just to see what would happen and I have the same jitter. There’s someone out there on this site who suggests using a 100pF capacitor (here’s another site that talks about it). Guess I need to buy some. I can get 50 for $1.60 on ebay (from China) or 100 for $3.00 (from the US). I need like 5 of them – ha.  Considering my last China purchase took about 40 days to get to me, I’m going with the $3.  I’m not terribly sure they’ll work for me, but for $3, its a decent gamble.

Hardware: Connecting the First Servo

This is fairly straight forward also:

  • Brown wire to Arduino Ground
  • Red wire to Arduino 5v
  • Yellow wire to Arduino pin 12

2

Follow

Get every new post delivered to your Inbox.