Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / Re: LTC6803-3 SPI on: March 18, 2013, 01:36:29 pm
So, no one has any input? Just looking for a little help so I don't build this board and get it completely wrong hahahaha
2  Using Arduino / Networking, Protocols, and Devices / LTC6803-3 SPI on: March 15, 2013, 06:16:26 pm
Hey Guys, I am attempting to interface a LTC6803-3 battery managment IC with an Arduino pro mini.
I have never used SPI and after looking into it some I am a bit confused.
Here is the datasheet
http://cds.linear.com/docs/en/datasheet/680313fa.pdf

On the LTC6803 its listed
Quote
CSBI
SDO*
SDI
SCKI

MAIN SPI PORT
TO HOST ┬ÁP OR
NEXT LTC6803-1
*REQUIRES 1k PULL-UP RESISTOR AT HOST DEVICE
 (SIGNAL NOT USED FOR INTER-IC COMMUNCATION)

On the Arduino pro mini its
Quote
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although provided by the underlying hardware, is not currently included in the Arduino language.

So I *think* it goes like this

LTC6803   <>   Arduino
43                   14
44                   13
42                   15
41                   16

And it asks for a pullup ressitor on SDO, so that means one end of the 1K resistor is connected to the trace between SDO<>MOSI and the other end is connected to VCC, correct?

One other question that is not really Arduino specific.. on page 13 of the datasheet it shows the LTC6803 daisy chained with a couple other ones. I do plan on being able to use a second one if needed, In the schematic it just lists a "digital Isolator" I have never used one of those.. wouldnt have any idea what to look for smiley-sad
It also lists that as 3V and the MPU as 3V, should I use a 3V arduino pro mini to make it easier?
3  Using Arduino / Displays / Re: 4Duino -- aka Yet Another 4D Systems uOLED Display Driver Library on: October 08, 2012, 01:24:22 pm
So I got it figured out.. total user error. I was only feeding the color command a value of 30, bumped it to 255 and its bright now..
I need more sleep hahaha
4  Using Arduino / Displays / Re: 4Duino -- aka Yet Another 4D Systems uOLED Display Driver Library on: October 05, 2012, 06:22:24 pm
Hey there.. I am using this library and loving it! After trying a couple of the other ones out there this one shines!

I am, however having a small problem.. My code at this pointis very simple. I literally just init the display then draw a couple lines. The lines are barely visible, it looks like the screens brightness is all the way off. I set the contrast to 15 and I can see the line a little.
I guess the question is, how do you turn up the brightness? I dont see anything in any of the files that talks about the brightness at all.

thanks again! great library!
5  Using Arduino / LEDs and Multiplexing / LED strip and motor controller? on: August 22, 2012, 05:28:16 pm
Hey guys, I am looking for a quick solution.. I have an LED strip that is 12v, I want to be able to fade the brightness on it with the arduino. I dont have time to order mosfets or transistors.
I guess my question is, can you just use a motor controller to output up to 12v to a simple LED strip? non RGB?
Seems to me it should work.. but I am a noob in just about all of this smiley-sad
6  Using Arduino / Programming Questions / Re: Maya and Arduino on: April 08, 2011, 10:45:18 am
It may well be that the Python code has issues with non-ASCII characters (those with values above 127). There is no real reason to use them as delimiters for numeric data. Sending '<', some number, ';', another number, and '>' would work just as well. On the Arduino, you can test for the character being '<', '>', or ';' and print them, too. Much easier to understand what is happening if you use ASCII separators, in my opinion.

I just realized something.. I was thinking that couldnt be it.. cause I am sending 0xFF from a different part of the python code to the robotis dynamixels, and that works. I send it as a big packet also (its ho you send commands to the AX12s).
So I went and coppied the code to paste it here.. and I AM using chr(0xFF) to send.. not sending jsut 0xFF lol so I will switch it to that for the arduino side also

Code:
def setReg(ID,reg,values):
    if values != lastAngle:
        length = 3 + len(values)
        checksum = 255-((ID+length+AX_WRITE_DATA+reg+sum(values))%256)         
        ser.write(chr(0xFF)+chr(0xFF)+chr(ID)+chr(length)+chr(AX_WRITE_DATA)+chr(reg))
        for val in values:
            ser.write(chr(val))
        ser.write(chr(checksum))
    return lastAngle
7  Using Arduino / Programming Questions / Re: Maya and Arduino on: April 07, 2011, 09:45:50 pm
Ok, so I changed them all to 13, and they seem to work fine like that. I think there is some miscommunication when using 0xFF, or just that type of data.. after 13 worked, I tried sending 0xFE and it didnt work.

The difference I see is when I send the 13 from python, I am sending like this
Code:
ser.write(chr(13))
when I try to send 0xFF or 0xFE I send it with no chr
Code:
ser.write(0xFF)

in the arduino I am trying to qualify like this
Code:
if(eop == 0xFF)
if(eop == 13)

So do I need to do something in the arduino code to tell it that 0xFF is not just characters?
8  Using Arduino / Programming Questions / Re: Maya and Arduino on: April 07, 2011, 09:29:13 pm
That means that serial data is getting through. So, print the values on the LCD that are in sop, mop, and eop. I'm guess that they are not 0xFF, 0xFF, and 13.
I am going to change the first bytes being sent.. I think it is actually getting 0xFF across cause when I try to print sop to teh screen which should be 0xFF, the screen blinks.. it just so happens that 0xFF is the code you send to the Matrix Orbital screen to tell it to be ready for a command like to turn backlight on or off lol.. so I think its getting the right thing 0xFF
9  Using Arduino / Programming Questions / Re: Maya and Arduino on: April 06, 2011, 02:23:39 pm
ok I added that..
Code:
void loop()
{
 // cursorHome(); 
 // Serial1.print("WFSB");//waiting for start byte
//not using cursorSet cause it doesnt work, just resets position to 1,1
//  cursorRight();cursorRight();cursorRight();cursorRight();

  // Serial1.print("ID is ");
   //newLine();

if(Serial.available() >= 5)
{
  Serial1.print("Bytes available: ");
  Serial1.print(Serial.available());
   int sop = Serial.read();
   if(sop == 0xFF){Serial1.print("got start byte");}
   int servoNum = Serial.read();
   int mop = Serial.read();
   if(mop == 0xFF){Serial1.print("got id byte");}
   int servoPos = Serial.read();
   int eop = Serial.read();
   if(eop == 0xFF){Serial1.print("got end byte");}

   if(sop == 0xFF && mop == 0xFF && eop == 13)
   {
      // Got a valid packet. Position servo servoNum to position servoPos
      Serial1.print("Got ID and PWM");
      Serial1.print(servoNum);
      Serial1.print(" ");
      Serial1.print(servoPos);
   }
}
}

the LCD prints out

"bytes available: " then a number that changes..
I saw numbers from 5 to 13, doesnt mean those are the only numbers.. just means those are the only ones I saw
10  Using Arduino / Programming Questions / Re: Maya and Arduino on: April 06, 2011, 12:29:28 pm
It isnt working as the arduino doesnt seem to be receiving the data.

I added some debugging to the code that prints to my lcd to see whats going on, and nothing comes thru. I did have another line in there that just printed to the LCD when it was inside the serial.read loop and it printed that, so the debugging to the lcd works.

Here is what I have.
Code:
void loop()
{
 // cursorHome(); 
 // Serial1.print("WFSB");//waiting for start byte
//not using cursorSet cause it doesnt work, just resets position to 1,1
//  cursorRight();cursorRight();cursorRight();cursorRight();

  // Serial1.print("ID is ");
   //newLine();

if(Serial.available() >= 5)
{
   int sop = Serial.read();
   if(sop == 0xFF){Serial1.print("got start byte");}
   int servoNum = Serial.read();
   int mop = Serial.read();
   if(mop == 0xFF){Serial1.print("got id byte");}
   int servoPos = Serial.read();
   int eop = Serial.read();
   if(eop == 0xFF){Serial1.print("got end byte");}

   if(sop == 0xFF && mop == 0xFF && eop == 13)
   {
      // Got a valid packet. Position servo servoNum to position servoPos
      Serial1.print("Got ID and PWM");
      Serial1.print(servoNum);
      Serial1.print(" ");
      Serial1.print(servoPos);
   }
}
}

Nothing comes up on the LCD.. so either "if(mop == 0xFF){Serial1.print("got id byte");}" isnt qualifying, or the arduino isnt receiving the data. Is that correct?
11  Using Arduino / Programming Questions / Maya and Arduino on: April 05, 2011, 07:31:40 pm
Hi Guys.. let me preface with I am a Arduino noob, and a serial communications noob.. I am just hacking my way thru things.

I work in Maya software from autodesk, and have been working on an interface between it and my robots. I know there is already "ServoTools for Maya" but that one is limited by servos being hard coded into the arduino sketch.
I have written a node in maya/python that is a lot more open than servoTools. I have it working with my Robotis USB2Dynamixel now, and I am trying to add the same kind of functionality to an arduino controlled robot.

Basically what I need is to be able to send a start byte to the arduino, then a servo ID (pin number for arduino) then the value that the servo needs to be.

This is what I have so far.. I ripped some of the SerialLCD stuff because I have a matrix orbital LK204-24 connected to my arduino mega for debugging readout.

arduino code
Code:
int mode = 0;              // where we are in the frame
unsigned char id = 0;      // id of servo
int pwmSend;

void setup()
{
  Serial.begin(38400);
  Serial1.begin(19200);
clearLCD();

//       Turn OFF the block cursor   
//       Note that setting both block and underline
//       cursors may give unpredictable results.
           Serial1.print(254, BYTE);
           Serial1.print(84, BYTE);               

//       Turn ON the underline cursor
         Serial1.print(254, BYTE);
         Serial1.print(74, BYTE);               
             
}

//  MAIN CODE

void loop()
{
  cursorHome(); 
  Serial1.print("WFSB");//waiting for start byte
//not using cursorSet cause it doesnt work, just resets position to 1,1
  cursorRight();cursorRight();cursorRight();cursorRight();

   Serial1.print("ID is ");
   newLine();

while(Serial.available() > 0){
        // We need to 0xFF at start of packet
        if(mode == 0){         // start of new packet
            if(Serial.read() == 0xFF){
                mode = 2;
                newLine();
                Serial1.print("GSB");//Got Start Byte
                 cursorRight();cursorRight();cursorRight();cursorRight();cursorRight();
            }
  }else if(mode == 2){   // next is index of servo
            id = Serial.read();   
            if(id != 0xFF)
                mode = 3;
                Serial1.print(id);
                 newLine();
                      }
    else if(mode == 3){   // next byte is length
      if(Serial.read() == 0xFF){
            pwmSend = Serial.read();
            mode = 4;
            Serial1.print("got pwm ");
            Serial1.print(pwmSend);
          }
        }
  // print text to the current cursor position
               // start a new line
}

}




//  LCD  FUNCTIONS-- keep the ones you need.

// clear the LCD
void clearLCD(){
  Serial1.print(12, BYTE);
}


// start a new line
void newLine() {
  Serial1.print(10, BYTE);
}


// move the cursor to the home position
void cursorHome(){
  Serial1.print(254, BYTE);
  Serial1.print(72, BYTE);
}


// move the cursor to a specific place
// e.g.: cursorSet(3,2) sets the cursor to x = 3 and y = 2
void cursorSet(int xpos, int ypos){ 
  Serial1.print(254, BYTE);
  Serial1.print(71, BYTE);               
  Serial1.print(xpos);   //Column position   
  Serial1.print(ypos); //Row position
}


// backspace and erase previous character
void backSpace() {
  Serial1.print(8, BYTE);
}


// move cursor left
void cursorLeft(){   
  Serial1.print(254, BYTE);
  Serial1.print(76, BYTE);   
}


// move cursor right
void cursorRight(){
  Serial1.print(254, BYTE);
  Serial1.print(77, BYTE);   
}


// set LCD contrast
void setContrast(int contrast){
  Serial1.print(254, BYTE);
  Serial1.print(80, BYTE);   
  Serial1.print(contrast);   
}


// turn on backlight
void backlightOn(int minutes){
  Serial1.print(254, BYTE);
  Serial1.print(66, BYTE);   
  Serial1.print(minutes); // use 0 minutes to turn the backlight on indefinitely   
}


// turn off backlight
void backlightOff(){
  Serial1.print(254, BYTE);
  Serial1.print(70, BYTE);   
}



here is the python code that sends the serial data to the arduino
Code:
def moveServo(servo, angle):
    ''' A function for setting the servo number and its angle.
   
    Example:
    >>> servo.move(1,180)'''
    if (0 <= angle <= 180):
        if angle != lastAngle[servo -1]:
            ser.write(0xFF)
            ser.write(chr(servo))
            ser.write(0xFF)
            ser.write(chr(angle))
            ser.write(chr(13))
            lastAngle[servo -1] = angle
            #print "running serial write"
            #print "servo " + str(servo) + " " + str(angle)
    else:
            print "Servo angle must be an integer between 0 and 180.\n"
    return lastAngle[servo -1]

the ser.write(chr(13)) was a test to see if sending a different character would be easier

anyone have any insight on how I can get this to work?
I thought I was close but am getting stuck smiley-sad
12  Forum 2005-2010 (read only) / Interfacing / Re: PQ12 Linear actuator on: April 08, 2010, 07:48:45 pm
Quote
Can you make your own PCB's, or afford to get them made?
If you can, it should be straighforward.

How small are you aiming for?

GB

Well I JUST finished putting together a proxon mill CNC and havnt even fired it up yet.. but I think I can use that to make them cant I?

as with lots of things when making robots.. the smaller the better smiley-wink ;D
13  Forum 2005-2010 (read only) / Interfacing / Re: PQ12 Linear actuator on: April 08, 2010, 11:36:48 am
Quote
Yes, you could do that.
There are a bunch of folks who make Mega prototype boards: google arduino mega protoshield
Not sure if they are big enough for 5 or 6 motor control chips. Maybe stack?

HTH
GB

Yeah I have seen some of that.. I really want it to be as small as possible tho. I swear I thought I saw a Mega "mini" but cant find it now smiley-sad
Id probably make each motor driver an individual board to make it possible to cram them in a smaller area
14  Forum 2005-2010 (read only) / Interfacing / Re: PQ12 Linear actuator on: April 07, 2010, 07:57:27 pm
Quote
I haven't used a Mega, but it has 14 PWM, 16 ADC, and 40 other digital pins, so in theory one mega could drive 14 motors.

HTH
GB

hmmm.. well then I should probably look at the schematic for the motor shield and just take what I need to drive the motors.. try to make them as small as possible
15  Forum 2005-2010 (read only) / Interfacing / Re: PQ12 Linear actuator on: April 07, 2010, 04:29:34 pm
Quote
I thought that too, but I looked at the motor shield schematic for Ladyada's board.

If you don't use the servo outputs (which are not needed for these actuators), it only uses 8 digital pins. It consumes 4 of the 6 PWM pins, but only 4 more digital pins for motor direction. It uses a shift register, 74HCT595, to expand those 4 digital pins to 8 for motor direction control.

At least two of the shift-register control-pins to the motor shield could be reused to control another shift registers for the same purpose.

So there are enough free pins to control another motor drive chip, using PWM1A & PWM1B, which would be enough for two more actuators, giving 6 in all.

There are only 6 analogue to digital (ADC) inputs on an (ordinary) Arduino to measure the feedback from the actuator's potentiometer (and thus implement position detection). So it would work out quite nicely.

HTH
GB

Hmmm.. interesting.. this sounds great, sounds like it would be perfect..

So if I needed to do 12 all together, I could make two with these mods.. would I then make two simple arduinos to control them, and have an arduino to control the whole thing?
What about using a mega to just control two motorshields.. i'll have to check the number of pins on the mega..

this is awesome guys.. thanks so much for all your help!
Pages: [1] 2