Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Troubleshooting / Re: How to get a stable reference voltage? on: November 30, 2009, 02:55:04 pm
I spent some time this weekend attempting to decouple my components with caps, with no success.  I suspect I'm doing something obviously wrong, since I've found other similar robots on the web which don't seem to do anything too complicated to get it working.

I think I have to change my wiring around... the 4 grounds coming  out of my h-bridge (currently going to the GND rail in various places) should probably go to a single ground line which should have a decoupling cap between it and the motor V+ line.  Am I thinking along the right lines?

Or perhaps I need to add decoupling caps between the lines going from the h-bridge to the motor?  between the 2 leads to each motor?

Maybe in both places?  Any advice or tips are greatly appreciated.

I've tried adding caps everywhere i can think of, but i'll keep trying. Between V+ and GND to the arduino, between V+ and GND to the sensor, all over the h-bridge, around the voltage regulator, along the rails of the breadboard.  At one point i had a bout 20 caps of various sizes on the darn thing!

As per your tutorial, I tried adding a resistor in series with Vin to the h-bridge or sensor but that prevents them from working for some reason...  (here's where you should roll your eyes)

I'll also try the inductor or choke method and then the opto-isolator next, as soon as i get those parts.

I may have to go with separate power supply's to run the motor and the IR sensor.  Would you suggest having a single battery connected to 2 voltage regulators (with caps), or 2 separate batteries?  Again sorry if this is a silly question.
2  Forum 2005-2010 (read only) / Troubleshooting / Re: How to get a stable reference voltage? on: November 27, 2009, 10:40:48 am
Thanks Grumpy_Mike,

I will carefully read the tutorial... it looks very useful for this issue.
If these techniques don't work out for me, is this the type of optoisolator that would work for the IC's I'm using?

3  Forum 2005-2010 (read only) / Troubleshooting / Re: How to get a stable reference voltage? on: November 26, 2009, 11:58:14 pm
I should also mention, I'm using a breadboard power supply, like the one shown in this tutorial:

4  Forum 2005-2010 (read only) / Troubleshooting / Re: How to get a stable reference voltage? on: November 26, 2009, 11:23:05 pm
Hi all,

I believe I have the same problem (on a much simpler robot).  I'm pretty new to electronics so please bare with me.  

I have an arduino also running two motors using a SN754410 h-bridge.  I also have connected a Sharp GP2Y0A21YK IR Range Finder to the arduino.  This is all done on a breadboard sitting on top of the chasis.  When no motors are running, i get a very clean and consistent read on the sensor.  Once I enable the motors, I see the readings gradually get worse until I get a false positive that an object is in range.  This happens within a couple seconds of the motors running.

I don't think I'm able to implement Mike Rice's solution with this Sharp sensor.  Please correct me if I'm wrong.

And pardon my newbiness, but I don't understand RuggedCircuits solution.  How would I isolate the motor grounds from the IR sensor ground?  Does the hunk-o-metal solution actually work?

Thanks in advance!
5  Forum 2005-2010 (read only) / Interfacing / Re: Arduino +Sparkfuns 4-digit 7-segment 16pin display on: February 24, 2010, 10:37:46 am
Boy, do I have a lot to learn about electronics.  

Thanks brtech for shedding some light on this stuff.
6  Forum 2005-2010 (read only) / Interfacing / Re: Arduino +Sparkfuns 4-digit 7-segment 16pin display on: February 23, 2010, 11:08:54 am
you're so right, the arduino community is amazingly helpful.  Our projects could combine to form some sort of super voltron clock display robot.

thanks for breaking this down for us.  Your explanation makes sense and I will experiment with changing digits and observing brightness.

I don't fully understand the 2nd part of your explanation tho, please bare with me and my questions:

You all are driving the digits directly.  That is okay as long as the resistor value is high enough.  You need the current through the digit (which is the sum of the current through each segment) to be less than 40 ma).

How did you figure out this 40ma limit?  The description on says "max forward current of 20mA"

If you used smaller series resistors on the segment drives, you would need to buffer the Arduino output with a transistor.

What would happen if you didn't, and your current on each digit exceeds 40ma?  Would the LED's burn out?

if you were to use something else to drive the digits (shift register), that 40 ma may not work.  Some shift registers can't sink 20 ma per segment either.

This part concerns me since I'm using a shift register (74HC595).  What would you recommend I do?  I've looked over the datasheet, but it makes little sense to me.
it says "+/- 6ma Output Drive at 5 V".  Does that mean it's giving me 6ma per segment without any resistors?

Thanks in advance
7  Forum 2005-2010 (read only) / Interfacing / Re: Arduino +Sparkfuns 4-digit 7-segment 16pin display on: February 22, 2010, 07:24:48 pm
By the way,
Like jeremytsl, I also used 1 resistor per digit instead of 1 per segment.  I'm not entirely sure but I think you can get away with that.

8  Forum 2005-2010 (read only) / Interfacing / Re: Arduino +Sparkfuns 4-digit 7-segment 16pin display on: February 22, 2010, 07:17:29 pm
Hey guys,

Wow, I posted this a while back and didn't think any responses were coming.  Thanks to everyone who contributed!

I've managed to resolve my issues with this display and it's working nicely now.  

I also have this working with an 8-bit shift register ( also from SparkFun).  So this might be of interest for you guys if you wanna use less arduino pins.

Please note: since my project involves temperature readings, this code is specifically for displaying temperature so digit 4 can be a 'C' or an 'F' and there are no decimals.

Here is the code along with pin descriptions.  I welcome any suggestions/questions/comments so please feel free to post:



4 Digit 7 Segment display from Sparkfun
 1: Digit 1         16: B
 2: Digit 2         15: G
 3: D                 14: A
 4: Colon Anode         13: C
 5: E                 12: Colon Cathode
 6: Digit 3         11: F
 7: Decimal Point  10: Apostrophe Anode
 8: Digit 4         9:  Apostrophe Cathode
8 Bit Shift Register

 1: display's B    16: 5V    
 2: display's C    15: display's A
 3: display's D    14: arduino's dataPin
 4: display's E    13: Gnd
 5: display's F    12: arduino's latchPin
 6: display's G    11: arduino's clockPin
 7: display's DP   10: 5V
 8: Gnd            9:  none
 Display's Cathode goes to ground via resistor
 Display's Anode goes to digital out
 Digit pins go to digital out via resistor
 Segment pins (A-G) go to digital out or shift register out (0 is on)

original shift reg code:

helpful schematic:


int latchPin = 8;  //Pin connected to ST_CP of 74HC595 (aka RCLK)
int clockPin = 12;  //Pin connected to SH_CP of 74HC595 (aka SRCLK)
int dataPin = 11;  //Pin connected to DS of 74HC595 (aka SER)

int digit1Pin = 5;  //can't use pin 1 since it's TX?
int digit2Pin = 2;
int digit3Pin = 3;
int digit4Pin = 4;

byte data;
byte dataArray[13];

const int MINUS_IDX = 10;
const int CELCIUS_IDX = 11;
const int FARENHEIT_IDX = 12;

void setup(){
  pinMode(digit1Pin, OUTPUT);
  pinMode(digit2Pin, OUTPUT);
  pinMode(digit3Pin, OUTPUT);
  pinMode(digit4Pin, OUTPUT);
  pinMode(latchPin, OUTPUT);


  //      A
  //    F   B
  //      G
  //    E   C
  //      D   dp (H)
  //  In binary representation, right most digit is A
  dataArray[0] = B11000000;
  dataArray[1] = B11111001;
  dataArray[2] = B10100100;
  dataArray[3] = B10110000;
  dataArray[4] = B10011001;
  dataArray[5] = B10010010;
  dataArray[6] = B10000010;
  dataArray[7] = B11111000;
  dataArray[8] = B10000000;
  dataArray[9] = B10010000;
  //temperature specific characters
  dataArray[MINUS_IDX] = B10111111;  // minus sign
  dataArray[CELCIUS_IDX] = B11000110;  // C
  dataArray[FARENHEIT_IDX] = B10001110;  // F

void loop(){

  setTemp(-23, 'C');
    //setDigit(digit1Pin, 3);
    //setDigit(digit2Pin, 4);
    //setDigit(digit3Pin, 5);
    //setDigit(digit4Pin, 6);

void setTemp(int temp, char scale){
  //temp must be between -99 and 999 in either scale to fit the display
  //put in a check here later
  boolean negative = false;
  if (temp < 0)
    negative = true;
  temp = abs(temp);
  if (scale == 'F'){
    setDigit(digit4Pin, FARENHEIT_IDX);
  } else if (scale == 'C'){
    setDigit(digit4Pin, CELCIUS_IDX);
  setDigit(digit3Pin, temp % 10);
  temp /= 10;
  if (temp >= 1){
    setDigit(digit2Pin, temp % 10);
    temp /= 10;
    if (temp >= 1){
      setDigit(digit1Pin, temp % 10);
  if (negative){
    setDigit(digit1Pin, MINUS_IDX);

void setDigit(int digitPin, int value){
    digitalWrite(latchPin, 0);
    shiftOut(dataPin, clockPin, dataArray[value]);  
    digitalWrite(latchPin, 1);
    digitalWrite(digitPin, HIGH);
    digitalWrite(digitPin, LOW);  

void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {
  // This shifts 8 bits out MSB first,
  //on the rising edge of the clock,
  //clock idles low

  //internal function setup
  int i=0;
  int pinState;
  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, OUTPUT);

  //clear everything out just in case to
  //prepare shift register for bit shifting
  digitalWrite(myDataPin, 0);
  digitalWrite(myClockPin, 0);

  //for each bit in the byte myDataOut[ch65533]
  //This means that %00000001 or "1" will go through such
  //that it will be pin Q0 that lights.
  for (i=7; i>=0; i--)  {
    digitalWrite(myClockPin, 0);

    //if the value passed to myDataOut and a bitmask result
    // true then... so if we are at i=6 and our value is
    // %11010100 it would the code compares it to %01000000
    // and proceeds to set pinState to 1.
    if ( myDataOut & (1<<i) ) {
      pinState= 1;
    else {      
      pinState= 0;

    //Sets the pin to HIGH or LOW depending on pinState
    digitalWrite(myDataPin, pinState);
    //register shifts bits on upstroke of clock pin  
    digitalWrite(myClockPin, 1);
    //zero the data pin after shift to prevent bleed through
    digitalWrite(myDataPin, 0);

  //stop shifting
  digitalWrite(myClockPin, 0);

9  Forum 2005-2010 (read only) / Interfacing / Arduino +Sparkfuns 4-digit 7-segment 16pin display on: February 08, 2010, 05:54:11 pm
I just received the following 2 4-digit, 7-segment displays from sparkfun:

The only difference between the 2 is the color and the voltage is 2.1V vs 3.4V.

So normally, a quick google search yields me pages of guidance, tutorials, schematics, and code.  I can't seem to find much on these displays, I suppose they are relatively new.

Has anyone successfully been able to use these displays?  If so, can you please supply your code, a schematic, and/or advice/tips?  

Any help is greatly appreciated!!
Pages: [1]