Category Archives: HW/SW Hacks

ISR PWM Motor Control

This code runs the Low Voltage Motor Booster Pack for the MSP-430 with the MSP430G2553 chip but could easily be adapted to any microcontroller. This uses Timer1_A0 to make a timing interrupt. Using the timing interrupt it changes the duty cycle of the PWM. Supports reverse by sending the “move_motors” command negative values.

Default is P2.0, P2.1, P2.2, and P2.3 for controlling the motor driver. P1.0 is toggled (on board LED) in the ISR.

Code: CCS V5


isr_motor_pwm.c
isr_motor_pwm.h
Project File Ver1.0


/*
*isr_motor_pwm.c
*Version: 1.0
*Parker Dillmann
*The Longhorn Engineer (c) 2013
*www.longhornengineer.com
*
*Check bottom of file for License.
*
*/

#include "msp430g2553.h"
#include "isr_motor_pwm.h"

#define Motor_DIR P2DIR
#define Motor_OUT P2OUT

#define Motor_A1 BIT0
#define Motor_A2 BIT1
#define Motor_B1 BIT2
#define Motor_B2 BIT3

volatile int Motor_Speed_A;
volatile int Motor_Speed_B;

volatile int Motor_isr_cnt;

void init_motors(void)
{
TA1CCTL0 = CCIE;             //Enable the CCR0 interrupt
TA1CCR0 = 50000;             // Set the interrupt register to "trip" each 50000 cycles"

TA1CTL = TASSEL_2 + MC_2 + TACLR;     //Timer_A Source Select; Set source to SMCLK, continuous mode, clear TAR

P1DIR |= 0x41;                            // P1.0 output

Motor_DIR |= (Motor_A1 | Motor_A2 | Motor_B1 | Motor_B2);    //Set Motors to output
Motor_OUT &= ~(Motor_A1 | Motor_A2 | Motor_B1 | Motor_B2);    //Set Motor outputs to 0

Motor_isr_cnt = 1;

return;
}

void move_motors(int Speed_A, int Speed_B)
{
Motor_Speed_A = Speed_A;
Motor_Speed_B = Speed_B;
return;
}

void stop_motors(void)
{
Motor_Speed_A = 0;
Motor_Speed_B = 0;
return;
}

#pragma vector = TIMER1_A0_VECTOR
__interrupt void Timer1_A0_ISR(void)
{
//Upkeep Time
Motor_isr_cnt++;
if (Motor_isr_cnt == 512)
{
Motor_isr_cnt = 1;
}

//Motor_A PWM
if (abs(Motor_Speed_A) >= Motor_isr_cnt)
{
if (Motor_Speed_A > 0)
{
Motor_OUT |= Motor_A1;
Motor_OUT &= ~(Motor_A2);
}
else
{
Motor_OUT |= Motor_A2;
Motor_OUT &= ~(Motor_A1);
}
}
else
{
Motor_OUT &= ~(Motor_A1 + Motor_A2);
}

//Motor_B PWM
if (abs(Motor_Speed_B) >= Motor_isr_cnt)
{
if (Motor_Speed_B > 0)
{
Motor_OUT |= Motor_B1;
Motor_OUT &= ~(Motor_B2);
}
else
{
Motor_OUT |= Motor_B2;
Motor_OUT &= ~(Motor_B1);
}
}
else
{
Motor_OUT &= ~(Motor_B1 + Motor_B2);
}

  P1OUT ^= 0x40;    // Toggle P1.0
TA1CCR0 += 500;  //Add offset to CCR0
}

IEE Flip VFD Working! Test code coming soon.

Today I wrote some code to get the IEE Flip VFD working. It has a fairly simple protocol and only took a bit of tweaking to get it working. I wrote the demo code for my Prop Dev Stick and will be uploading the SPIN code later once I finish the feature set.

After this I will write some C code for the MSP430 LaunchPad and get that working. The screen supports a serial input mode which saves 8 I/O pins but requires more timing. I will try to get that working as well.

IEE FLIP Alphanumeric Display Works!

I picked up some of these really neat VFD alphanumeric displays at a surplus shop while at Maker Faire. After acquiring the datasheet from the manufacture, I decided to test them with the built in test mode. I have already started writing the code to run the display and will be posting the code and datasheet when it is done.

Atari 7800 Video Sniffed

I have been wanting to do this for awhile but have not gotten around to it. I took my Open Bench Logic Sniffer and sniffed the e (in picture from top to bottom) of the Atari 7800 MARIA chip. This is what the signal looks like before it goes into the video mod (D/A converter).

I am still learning how this translates into a picture on the screen. If anyone has any insight into this let me know.

NES 2 Video mod Schematic

So the NES 2 only outputs RF which isn’t good when you want to portabilize it or use it with modern Tvs. Most composite mods out there don’t really do a good job at fixing the issue as there is some vertical lines that show up. This mod does not have any vertical lines.

Propeller Development Kit

How to make a Propeller Development Kit


Read through the instructions carefully before attempting. Also read the disclaimer.

I needed a Parallax Propeller Development Board so I could keep working on my projects. Having to pull out my only prop from the pinball machine to test circuits was slow. I looked into getting the Gadget Gangster which lays out the propeller in a form familiar to those that have worked with the Arduino boards and has “shields” being built for it.

However at the time of this writing it was out of stock and I needed the board quickly so I decided to build my own on proto board. The Gadget Gangster is built off a .1″ pitch so copying the layout was easy to do on proto board. I decided that the Dev Board I would make would be much more flexible as I can add on more standard features like an Analog to Digital Convertor without having to add a shield.

I looked up a couple schematics and layouts which I have included below.

Gadget Gangster PCB Layout
Gadget Gangster PCB Layout 2
Gadget Gangster Full Schematic
Propeller Proto Board Schematic – Refer to Pg5.
SD Card Pinout – Not mine, found it on the web.
SD Card Pinout 2 – Look at SPI mode.
Interfaceing a SD card with the propeller

Besides VDD and VSS on the SD card every data line (CLK, DO, DI, RSV) should be pulled up to VDD with a 10k resistor.

Here is a incomplete parts list for the project. It just includes all what you will need. Some stuff like capacitors are not on the list as I had those on hand.

Digi-key Part #’s

1 – P8X32A-D40-ND – DIP Propeller
1 – 101-00405-75-ND – SD Card Slot
10 – CF18JT10K0CT-ND – 10kOhm Resistors
1 – 24LC512-I/P-ND – EEPROM
1 – LM2937ET-3.3-ND – 3.3V Regulator
1 – XC1711-ND – 5Mhz Crystal
2 – S7014-ND – 14 Pin Female Headers
2 – S7002-ND – 4 Pin Female Headers

Some things you will also need. I had these on hand so I don’t have part numbers.

3 – 100uf 16V Capacitors (Electrolytic)
2 – .1uf 50V Capacitors (Ceramic)
1 – Power Connector
1 – Power Switch
1 – 7805
1 – Power LED and Resistor to match for +5V source
1 – Normally Open Tact Switch
1 – 4 Pin Male Right Angle Header

You will also need a 7-12V DC power supply that fits the power jack. I used a Sony 9V DC supply that I had lying around.

This Dev Board also needs the Prop Plug for the USB connection. This can be used over and over again so if you are planning on making several Propeller projects then it is cheaper to go this route.

I would suggest you build the power circuit first and test it with a multimeter to make sure it is operating correctly before hooking it up to the microcontroller. This ensures you don’t ruined your $8 part and have to wait 4 days for the replacement to come in.

For the proto board; Radio Shack sells really inexpensive proto boards. For $4 they sell there 4″x6″ which is what I used for this project.

http://www.youtube.com/watch?v=Tc5mCpTmNBs

Sega Neptune

How to make a Sega Neptune



Read through the instructions carefully before attempting to start this project. Also read the disclaimer.

This guide is sponsored by Super Fighter Team.

The first Neptune I built can be found here. Since then I have updated the design to require only one power supply. The Genesis 2 and 32X module can run off of 650mA which is under the 850mA that the stock power supply offers. You may wonder why Sega didn’t just have the 32X draw power from the cart slot or just have a jumper cable running from the back of the Genesis power supply to the 32x? Well the cart slot can’t power the amp hungry 32x but I don’t know why Sega went with a separate power supply over a just a splitter/jumper.

This guide is a step by step overview of how to make a Sega Neptune that only uses one power supply and features region mods. This project may look daunting but it is fairly simple and straight forward. There are no supper tricky soldering situations (unless you do the region mods) so anyone that has moderate experience with a soldering and desoldering iron can build a Neptune.

Sega Genesis 2 with a 32X module on top. Our goal is to squeeze all that into the Genesis 2 case.

For this project you will need the following tools

  • Soldering Iron – 15W-25W
  • Desoldering Iron – 25W
  • Needle Files
  • Assorted Screwdrivers
  • Dremel like tool with Cutting Discs
  • Needle Nose Pliers
  • Hot Glue Gun

Parts Needed

  • Sega Genesis 2
  • Sega 32X
  • Lots of Ribbon Cable
  • 3 DPST Switches (for region mods)

Back of the 32X.

First start by disassembling the 32X. There are a lot of screws so make sure to get them all. Some are hidden on the vertical part of the 32X so make sure to get those too.

Top off of 32X.

After taking the top off the 32X remove all the screws holding the RF shielding and 32X board to the casing.

With all the screws gone the vertical portion of the 32X should slid through the bottom casing. The sides of the vertical portion should then be removed.

Flip the 32X over and find these tabs near the underside of the cart slot. Straighten them out with pliers and flip the 32X back over.

Take a small flat head screw driver and pry the RF shielding off the 32X cart slot. Make sure to be careful and not slip as damage to components and traces can occur.

There are two white ribbon cables that connect the two 32X boards together. Take these ribbon cables off by pulling them straight out of the slots that hold them in place.

Using a hammer, smash the ring to remove it. This ring is used to help prevent data corruption over the ribbon cable and please the FCC but the 32X seems to work fine without it and the 32X needs the space to fit inside the Genesis 2 case. After removing the ring replace the ribbon cables back into the slots on the 32X.

Using a desoldering iron remove the video output from the 32X. Don’t force it as you will have to use this part again. When removed take the metal shielding around it off.

Video output removed and shielding taken off.

Reattaching the video output jack.

Solder some wire about 6 inches long to the video output contacts. I used standard ribbon cable wires for it.

Then take those wires and solder them to their corresponding points on the jack. Its a good idea to test the 32X now. If it fails to work make sure you haven’t bridged a connection anywhere.

Now to disassemble the Genesis by removing the 4 screws that hold the Genesis 2 case together and take the top off.

Take the cart flaps off the underside of the top of the case by removing the 3 screws that hold it in place.

Now remove all the screws that hold the Genesis board to the RF shielding and case.

Some boards have different layouts. This one has the 7805 voltage regulator and filter capacitor right next to the cart slot so it will have to be relocated to the back of the case. If the board has the 7805 located at the back of the board skip the relocation of the 7805 and large capacitor.

The offending 7805 and capacitor.

Flip the board over to the bottom and desolder the 7805 and capacitor. Pay attention to how both where orientated on the board.

Reattach the 7805 by soldering 3 wires of about 4 inches in length to the 7805 and the board. Make sure to get the orientation of the 7805 correct. Use a heavier gauge like 20 AWG for this.

And do the same for the large cap.

Location of the capacitor. Pay no attention to the 7805 as I found a better location for it.

Now flatten the capacitors on the board to reduce the overall height off the board. Just heat up the contacts and pull them slightly to extend the leads a bit then fold the capacitor over. Be careful not to pull the traces off the board or rip a leg off a capacitor.

Now for the tricky part. Desolder the 64 contacts to remove the cart slot on the Genesis board. However, the cart slot won’t come off the board without removing some rivets.

Bottom of rivets

Top of rivets

To remove the rivets take a small flat head and position it like shown above. Push the edge inward. Be careful not to slip.

Edges of the rivet pushed in.

Then take a Philips head screwdriver and push the rivet out of the board. The cart slot should come free from the board now.

Clean the contacts on the 32X by rubbing some fine steal wool on them. This removes the oxidized layer on the metal and makes soldering easier.

Tin the contacts on the 32X. Make sure to use plenty of flux.

Connecting the Genesis to the 32X!

Using ribbon cable attach the 32X to the Genesis. The wires closest to the front of the Genesis need to be cut at 4″ and the other row needs to be 3.5″ in length. This will ensure that the wires are straight and untangled.

On the far side of the 32X the wires need to be attached upside down. When the 32X is folded down on top of the Genesis these wires will lie straight. I should have taken more pictures of this part but my first Neptune I built has some pretty good pictures of this part Neptune. I used thicker wires in that version but the method is the same.

Make 3 aluminum shields. I think I made them 3.75″ by 4″. They are 4 layers thick and covered in packaging tape to prevent short circuits. These help separate the two sets of wires and help prevent cross talk.

Place one in between the two sets of wires and one on each side of the wires like a sandwich. This is a good time to see if the Neptune is working. If it fails double check every connection and inspect the board for solder spills.

Solder some wires to the contacts shown. I cut my wires to be 7 inches long. This is to replace the cable that connects the Genesis A/V out to the 32X A/V in. Attach some heavy duty wire (18AWG) from the power input on the 32X.

Now desolder and remove the video output on the Genesis board. Then attach the wires from the 32X to the exact same spots on the Genesis video output. Make sure to solder to the bottom of the board and leave the top clean. Then attach the power wires from the 32X to the input on the Genesis.

Now take the Video output from the 32X and hot glue it upside down to the old spot of the Genesis video output. The port may be a little high so file down the hole to make it bigger.

Back of the Genesis. Ignore the fact that the power plug is missing...

Double check every connection and test the Neptune. Remember to inspect the board carefully for solder spills. If it doesn’t work the problem most likely lies with your 32X/Genesis cart connection. Check to make sure the wires are straight and untangled.

If region mods are wanted this is the time to do them. The mods are everywhere on the net so I won’t post on how to do them. MMMonkey has a really good guide on MD2 mods and for the 32X head on over to here. The 32X one is in french but google translates it pretty well. I used the simple version. I attached the switches to the back of the Genesis casing.

Location of region mod switchs

Bend the 7805 so it lies on in this corner. You may have to bend the bottom RF shielding to get it to fit.

Can't play doom yet.

Genesis games are smaller then 32X games the cart slot needs to be widened. Place a 32X cart on top of the slot and trace around it with a pencil. File down the plastic till it fits.

Can play doom now!

If you have an import JPN game you will have to cut some more of the cart slot. Use the same method.

Modified cart flap doors.

If cart slot flaps are wanted take the cart slot mechanism from the 32X an cut it down like shown above.

Hot glue these flaps to the inside of the Genesis 2 case.

Use #4 1″ wood screws to attach the 32X to the genesis board and casing. The holes around the 32X cart slot will line up with the holes on the Genesis board. Go ahead and test the Neptune to make sure it works.

Side view of the PCB sandwich.

Place the cover back on the Neptune and test the cart flaps if you have them installed. Most likely the flaps will hit the cart slot. If so cut off the edges of the cart slot with your dremel.

Put the cover back on the Neptune and replace the 4 screws. It is now done.

Some final pictures.

DOOOOOOOOOOOOOOOOOOOOOM!

Beggar Prince by Super Fighter Team.

Plays any region!

A special thanks goes out to Super Fighter Team for sponsoring this how to!