Show Posts
Pages: [1] 2 3
1  Using Arduino / Microcontrollers / USB to Serial conversion for breadboard Atmega on: February 21, 2013, 01:43:49 am
Heya,

I have a Mintduino kit and didn't get the FTDI interface needed to program it.  I know I can pick one up at radio shack or even use another Arduino to do this, but I've decided to do things the hard way.  I obtained a 'memory stick datalogger' made by Parallax designed to be used with the BASIC stamp and other products.  It's main use is for external data storage but can also be used just as a converter.  I've connected the pins of the datalogger to the mint correctly, the LEDs turn on for both but get the 'port not found' (I believe) compiler error. 

My questions:
Does anybody know if it is even possible to use this Parallax converter with Atmega328?
If so, what are the first steps I should take or where can I find the info to hook it up with?  (I've downloaded the data sheets for the converter but don't completely understand them)

Thanx for any help with this
2  Topics / Robotics / Re: 2 servos (or any functions) operating simultaneously? on: February 20, 2013, 02:23:35 am
PaulS:
What a knee slapper, glad I don't know what else you do for fun.  I always thought I was amusing, either that or funny looking. 
So when you're done wiping your chin, ya wanna post a USEFUL comment?  Interject some information that is actually demonstrative of your programming prowess?
Judging from the cocky remarks, the hassle involved is too great and it's much easier to leave snappy critiques that generate that satisfying feeling of self aggrandizement. 
Perhaps I was a bit presumptuous thinking I could come here, without any experience, for more than a spitting contest but to get help and learn a few things.
I wish I could say I appreciate all that you've offered here, Paul, my good buddy smiley-wink
3  Topics / Robotics / Re: 2 servos (or any functions) operating simultaneously? on: February 10, 2013, 02:45:10 pm
wildbill:

Thank you for your suggestions, I will try that and see what happens.

AWOL:

I can really only gather that you deem my attempts at composing a code I can use as hardly worth looking into.  On the other hand I would have to consider my query as worthy of attention seeing as how there are over 2000 views of this thread.  That would imply to me that there is a substantial number of people interested in the exact same information but who may be without the patience to be persistent in asking for help with it.
So when you get your dander up, do you shred your clothes and turn green? (just kidding) smiley-mr-green
4  Topics / Robotics / Re: 2 servos (or any functions) operating simultaneously? on: February 10, 2013, 06:48:49 am
AWOL:
I can't say it makes or had made much sense to me either.  That just happened to be my last fairly random guess at changing the statement before I posted the code.  But, that's why I posted it, because I don't understand what was wrong with it in the first place before I tried a number of different combinations in order to at least get it to compile.

You already made it clear it doesn't make sense and this is what I already know as well, so further describing how it is senseless using simile is redundantly saying it again with a nice touch of sarcasm.  Although it may help me realize how little I understand about programming in C++, it doesn't exactly help me get any closer to my goal of operating servos for a hexapod which is the reason for this thread.

I was hoping to gain insight into how this code could be corrected, rearranged or at least experimentally altered, or pointed in some useful direction that may lead towards a solution.  A suggestion for a different approach, or as to how it might be changed, or added to, or parts to be removed would probably benefit my situation.  If your brain refuses to recognize what is going on, it would seem that there is little motivating any investigation into the underlying issue/s with this code, and then I wonder, why bother.
5  Using Arduino / Microcontrollers / Re: Help with programming do it yourself microcontroller? on: February 08, 2013, 10:45:34 am
Ah ha, well maybe it wasn't such a bad deal, I'm sure I will have a use for the FTDI in the future.  Coolness does usually come at a cost, guess I'm just used to it being free smiley-cool  Yeah, no where on the package does it say anything about additional components, that info is at the end of the online tutorial.  Oh well, no big deal. 
Thanx guys

 so when I do get the interface, what board and programmer would I most likely set in the compiler?  I'm assuming it already has a bootloader
6  Using Arduino / Microcontrollers / Help with programming do it yourself microcontroller? on: February 08, 2013, 05:15:53 am
Hello,

So I bought a Mintduino kit the other day to help me understand micro-controllers better.   I'm a little disappointed.  Compared to an Uno, it seems that you get about half as much for about a third more in cost, great marketing scheme.  No manufacturing, less components, cheaper components, no tech support or complete instructions and sell it for more.  They don't tell you that you need to buy their FTDI serial adapter (or whatever it's called) to be able to program it.

Anyway, instead of buying the FTDI serial interface, I rearranged the wiring in a serial B type of cable so that Gnd, Vcc, Tx, Rx all lined up to the pin configuration according to their build.  It powers on, the light blinks, but I can't program it because I the COM ports on my PC don't seem to line up with the device.  COM 3 doesn't work for some reason.  COM 12 is what I use with the Uno but for some reason it won't appear as a choice in conjunction with the MIntduino.

The Mint uses an ATMEGA328 chip.  I don't know if or what presets it comes with except for the blinking light.   The compiler error I get is:   avrdude: stk500_getsync(): not in sync: resp=0x30
I also get a popup:  USB Devoce Not Recognized

I'm not sure what to do.  I'm not sure which board or programmer to set it to in the compiler.  Or what should be done in device manager of the PC. 

Has anyone built their own or bought one of these kits and got it to work?
Thanx for any help with this
7  Topics / Robotics / Re: 2 servos (or any functions) operating simultaneously? on: February 08, 2013, 04:42:17 am
http://playground.arduino.cc//Code/MegaServo
8  Topics / Robotics / Re: 2 servos (or any functions) operating simultaneously? on: February 08, 2013, 03:30:56 am
AWOL:  
If I knew, I could tell you.  
At some point I had tried some random switching of terms, that's probably what that is a result of.
Correct me if I'm wrong.  Your comment would imply that you can easily see or even know for certain that something is not right with that particular line of code.  I'm fairly sure that's not the only error but if you would care to expand on your comment a bit and share some of the wisdom I am not privy to, I would more than appreciate being exposed to what you know about it. 

PaulS:
I was thinking the same thing when I saw something similar in another code but figured I would give it a shot anyway.
While we are on the subject of luminescence, would you like to shed some light on why the idea is so dim?  Maybe explain the conflict or possible conflicts?  Can instance and class written structures be/look exactly the same?  Could you suggest how it be done differently?  What would you do in such a case?  Does this even need to be done at all?


What I do know is that there is only one compiler error in the revision - an enormous improvement from the original in the playground where it is stated (in sum):  just copy and paste, no changes necessary.  I don't know who's smoking more of what on the playground but as you can see it clearly was not that simple.  Unless of course there is some obvious step omitted that every programmer knows to be common knowledge while overlooking the inexperienced newbie who's yet to be a programmer.  
9  Topics / Robotics / Re: 12 Servo Quadruped - Servo Shield selection discussion on: February 07, 2013, 02:26:25 pm
DuaneB and oric_dan:

Thank you for posting some links on servo control, I've been trying to figure out how to do it for a while now.
10  Topics / Robotics / Re: 2 servos (or any functions) operating simultaneously? on: February 07, 2013, 02:18:01 pm
Ok, so I found a new approach to my problem.  I'm a bit more hopeful but I can't get it to compile. 

Here is what I found (the list of compiler errors is huge):
Code:
//(this sketch is straight from the playground)
// test sketch for MegaServo library
// this will sweep all servos back and forth once, then position according to voltage on potPin

#include <MegaServo.h>

#define FIRST_SERVO_PIN  22 

MegaServo Servos[MAX_SERVOS] ; // max servos is 32 for mega, 8 for other boards

int pos = 0;      // variable to store the servo position
int potPin = 0;   // connect a pot to this pin.

void setup()
{
  for( int i =0; i < MAX_SERVOS; i++)
    Servos[i].attach( FIRST_SERVO_PIN +i, 800, 2200);

  sweep(0,180,2); // sweep once   
}

void sweep(int min, int max, int step)
{
  for(pos = min; pos < max; pos += step)  // goes from 0 degrees to 180 degrees   
  {                                  // in steps of 1 degree
    for( int i =0; i < MAX_SERVOS; i++){
      Servos[i].write( pos);     // tell servo to go to position 
    }
    delay(15);                  // waits 15ms for the servo to move
  }
  for(pos = max; pos>=min; pos-=step)     // goes from 180 degrees to 0 degrees
  {                               
    for( int i =0; i < MAX_SERVOS; i++){
      Servos[i].write( pos);     // tell servo to go to position 
    }
    delay(15);                  // waits 15ms for the servo to move
  }   
}

void loop()
{
  pos = analogRead(potPin);   // read a value from 0 to 1023
  for( int i =0; i < MAX_SERVOS; i++)
    Servos[i].write( map(pos, 0,1023,0,180));   
  delay(15);   
}

I compared the above sketch to others I found (sorry they aren't cited, I didn't record where the other similar examples were from) and here are the changes I made:
Code:
#include <MegaServo.h>
#include <Wire.h>
#include <arduino.h>

#define NBR_SERVOS 12
#define FIRST_SERVO_PIN  2 
  MegaServo Servos[NBR_SERVOS] ; // max servos is 12
   MegaServo MegaServo;
int pos = 0;      // variable to store the servo position
int potPin = 0;   // connect a pot to this pin.
 
void setup()
{
   Serial.begin(9600);
  MegaServo.writeMicroseconds(1500);
  int i = 0;
  pinMode(i,OUTPUT);
}

void Servos digitalWrite.MegaServo( )
{
  for( int i =0; i < NBR_SERVOS; i++)
    Servos[i].attach( FIRST_SERVO_PIN +i, 800, 2200);

  sweep(0,180,2); // sweep once   
}

void sweep(int min, int max, int step)
{
  for(pos = min; pos < max; pos += step)  // goes from 0 degrees to 180 degrees   
  {                                  // in steps of 1 degree
    for( int i =0; i < NBR_SERVOS; i++){
      Servos[i].write( pos);     // tell servo to go to position 
    }
    delay(15);                  // waits 15ms for the servo to move
  }
  for(pos = max; pos>=min; pos-=step)     // goes from 180 degrees to 0 degrees
  {                               
    for( int i =0; i < NBR_SERVOS; i++){
      Servos[i].write( pos);     // tell servo to go to position 
    }
    delay(15);                  // waits 15ms for the servo to move
  }   
}

void loop()
{
  pos = analogRead(potPin);   // read a value from 0 to 1023
  for( int i =0; i < NBR_SERVOS; i++)
    Servos[i].write( map(pos, 0,1023,0,180));   
  delay(15);   
}
compiler error:  MegaServo:23: error: expected initializer before 'digitalWrite'

This is the only error that this version produces.  I don't know that it's necessarily a good thing or not.  I guess I don't understand what an 'expected initializer' is, even after some research on it.  If this does end up compiling, I don't know that it will work correctly as I don't understand most of what is going on in it.  Please don't ask me WHY I made some of the changes were made in it as I don't really remember and probably couldn't tell you in the first place.  All I know is that this is the closest it has come to compiling.

Thanx for any input on this
11  Using Arduino / General Electronics / Re: Measuring voltage, using AREF pin? on: January 31, 2013, 01:41:28 am
So I built a simple pulse generator using a 555 chip to run some tests with before I start cutting wires on my ride.  I'm having trouble getting an accurate voltage reading because of the pulse effect.  I wouldn't be too worried about it except I'm having to power the circuit at 6.5V (I don't have an easy 5Vcc source and the next increment on the supply is 4.5V where the 555 doesn't like to operate correctly).  I think there should be enough of a voltage drop through the generator before Vout but it would be nice to verify it before connecting it to the arduino.

MarkT:

I think I will need as much accuracy as possible.  1/10th Volt will be more than a significant difference in the return signal to the PCM (powertrain control module, aka ECM).  Do you think diodes can be used to accurately drop voltage before Aref? 

When you refer to 'Vcc', is this to Vin on the arduino for power?  If the answer is yes, is the forward direction of the diode from Vcc to Aref?  and then, Does it need to be a Shottky?  I may have one but I'm not sure I'd be able to distinguish them from others.

Is it a good idea, or even possible, to use the arduino supply voltage as the reference to Aref as well? 
The sensor supply should be at 5V, I'm thinking I could parallel the arduino with it and also use it as the reference since the PCM is most likely measuring the sensor's return signal against this same supply voltage as well. (the PCM supplies all of the sensors with 5Vn)   

    Seems like a good idea to me but I don't know that my thinking is correct

Thanx
12  Using Arduino / General Electronics / Re: Measuring voltage, using AREF pin? on: January 28, 2013, 12:31:29 pm
Thank you very much for the pointers and advice.  It's exactly what I was looking for to get started.

I'm sure I will have more questions in the near future.  This will end up being a fairly involved project dealing with sensor manipulation of my vehicle where I'm going to try to make otherwise impossible adjustments to the fuel injection system.

I just found this and it looks like what I need to begin
Code:
/*Example 22.1  Measuring range of analogRead() using a 1.8V AREF voltage 
tronixstuff.com/tutorials  CC by-sa-nc
*/

int analoginput = 0; // our analog pin
int analogamount = 0; // stores incoming value
float percentage = 0; // used to store our percentage value
float voltage =0; // used to store voltage value

void setup()
{
  Serial.begin(9600);
 analogReference(EXTERNAL); // use AREF for reference voltage
}

void loop()
{
  delay(200);
analogamount=analogRead(analoginput);
percentage=(analogamount/1024)*100;
voltage=analogamount*1.75; // in millivolts

  Serial.print("Percentage of AREF: ");
  Serial.println(percentage,2);
  Serial.print("voltage on analog input (mV): ");
  Serial.println(voltage,2);
}

I'll be back after I've done some experimenting/testing

Thanx!
13  Using Arduino / General Electronics / Measuring voltage, using AREF pin? on: January 28, 2013, 04:31:42 am
Heya,

When using the arduino as a voltmeter AND using the Aref pin for accuracy, what should the circuit's path look like?
    ~I thought I would make an inquiry before experimenting to avoid doing anything foolish.

For instance:
Say I want to measure line/signal voltage either to or from a component (similar to that carried on the third wire of a servo) and I know it is less than 5V (no resistance or division required for analog input).
  
       I'm thinking that I would need to splice into or otherwise probe the line for a voltage to route to an analog input pin, then return (analog output pin) to the ground of that signal.

Now, what gets used as a voltage for Aref?  Would it be the +voltage (Vn) before the load/impedance from which the signal originates?  Or should the arduino use its own internal reference? is it possible for arduino to use an internal reference to measure an external voltage?  
   -All of these questions are basically asking: how is Aref pin properly applied to voltage measurement?

I found this and it appears to work nicely, except I don't need to measure voltage on the board.  It looks like it may be useful but first I need to figure out what the 'voltmeter' circuit should look like.
Code:
//voltage returned in millivolts 5000 = 5V
//although for Arduino it usually makes more sense to measure against Vcc, the positive power rail.
//measure how large the known 1.1V reference is in comparison to Vcc, you can back-calculate what Vcc is with a little algebra.
//http://code.google.com/p/tinkerit/wiki/SecretVoltmeter

long readVcc() {
  long result;
  // Read 1.1V reference against AVcc
  ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
  delay(2); // Wait for Vref to settle
  ADCSRA |= _BV(ADSC); // Convert
  while (bit_is_set(ADCSRA,ADSC));
  result = ADCL;
  result |= ADCH<<8;
  result = 1126400L / result; // Back-calculate AVcc in mV
  return result;
}

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println( readVcc(), DEC );
  delay(1000);
}
14  Using Arduino / General Electronics / Re: Servo twitch on startup on: January 28, 2013, 03:25:52 am
Both of the servos I have (2 diff brands) do something similar.  They (or at least one) actually give 2 little twitches before a bigger twitch, then go to either 900 or wherever I have them positioned in setup, but sometimes it will be just three little twitches before default.  The only thing that seems to make a difference (maybe) is how much torque is on them at power on.  They also twitch every time I turn on the serial monitor.
15  Topics / Science and Measurement / Re: Help with Arduino digital thermometer!? on: January 27, 2013, 01:15:11 am
1EAS1:

Here's something I found that you might be interested in:

Code:
//TEMP in deg C ~ /10000
//The sensor isn't very accurate - the data sheet says ±10°C. But once you've worked out the offset and correct for it, accuracy improves
//This sensor is pretty useless unless you calibrate it against a known temperature.
//The sensor outputs in approximately 1°C steps.

long readTemp() {
  long result;
  // Read temperature sensor against 1.1V reference
  ADMUX = _BV(REFS1) | _BV(REFS0) | _BV(MUX3);
  delay(2); // Wait for Vref to settle
  ADCSRA |= _BV(ADSC); // Convert
  while (bit_is_set(ADCSRA,ADSC));
  result = ADCL;
  result |= ADCH<<8;
  result = (result - 125) * 1075;
  return result;
}

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println( readTemp(), DEC );
  delay(1000);
}

I just ran the code last night and it gave me an avg temp (on the arduino board) of 26 C ~ 78.8 F.  I'm going to compare the arduino value to another digital thermometer (infared? I think) for accuracy as soon as I can find it.  You may not have much use for this because it measures the temp of the board, but you never know when it might be useful.
Pages: [1] 2 3