Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Troubleshooting / Re: Skecth does't work if bigger than 8K on: January 03, 2008, 01:55:14 am
I'm overall very pleased with the Arduino compiler, I like how it tells how many bits are used out of a maximum.  I was just wondering today if it counted up the number of bits used by variables (such as an int using a maximum number of bits, or a long using another number of bits).  And basically... Does it?  Is this the question you guys just answered?

I'm new to this and I'm more of a mechanical guy, so this isn't exactly my realm (but I am finding it quite fun and interesting).
2  Forum 2005-2010 (read only) / Troubleshooting / Re: Pins 2 and 3 can't light up an LED? on: January 05, 2008, 12:01:05 pm
Yes, I did.  I did all the output pin declarations in the same place, those were the only two that were not working.
3  Forum 2005-2010 (read only) / Troubleshooting / Pins 2 and 3 can't light up an LED? on: January 03, 2008, 12:33:55 am
I'm in the beginning stages of my project (essentially a stopwatch) and I was starting off by getting my base code in place.  So far, I just have it light up a new LED in an array of LEDs every second.  The issue is that the first two LED's don't light up all that bright.  I know it's not the LED's because I've switched them out with ones I know work.  So I've tested it in a variety of methods and it seems overwhelmingly positive that it's something Arduino is doing.  So my question is as such:

do pins 2 and 3 have a resistor in them that is much higher than others?
can they not output the same voltage/current as the other pins?
could my Arduino be damaged?

I should note that the LED's DO light up, but not nearly as bright as they should, you can really only see it in low light.

Thanks!
4  Forum 2005-2010 (read only) / Interfacing / Re: 12v pulse for input? on: January 07, 2008, 11:12:55 am
Thanks for the info!
 
I'm trying to do something similar, I have some optical "break beam" sensors that operate at 11-28VDC (I will be using 12, also) that output as either NPN or PNP transistors, so the digital signal they output will be my input voltage (can't be less than 11 volts, as stated).
 
So yeah, I have the same problem, this is just the info I was looking for, thank you very much!
 
Also this is nice to know for interacting with standard 12 volt automotive voltages, sweet!
5  Forum 2005-2010 (read only) / Interfacing / Re: hall effect sensor as a rpm mesauerment device on: January 04, 2008, 10:31:39 pm
Oh, this topic is interesting...

Hypothetically...

So you're listening to the RPM from a hall effect sensor, but you also want to ouput info to a serial LCD or save info to a USB thumb drive (serial) or send information via wireless (probably serial) to some other device (another arduino?) and you want to listen, or at least post for button inputs because you have a few user inputs... yeah how?  How many things can you have interrupts for?

Could you make a simple device to take in the hall effect reading and output an analog signal based on that reading?  say at like 1hz reading every second (really slow RPM) vout = 0v and your limit of 100hz vout=5v.  You're going to have your "speedometer"

Then Arduino wouldn't really have to listen,but rather post for it.  Assuming you don't have any really long loops, you'd probably pick up the vout at least every 100hz...  It'd be like a rolling average, but it couldn't ever be too far behind, at least as far as mechanical things go...  The problem with hall effect sensors is that they can't really read 0rpm, it has to be assumed.

That's still something I'm having trouble getting my head around as a mechanical guy playing with electrical stuff... 16Mhz is extremely fast for me, 16million operations every second?  wow... hard to believe you couldn't pick up something running at 100hz, the issue of course is not if you can pick it up or not, but if you miss the signal, like the hall effect sensor trips when you're not posting for it so you only pick up say 99hz when it's really 100...  how much of a difference does it make in the end?

In reality, if you wanted Arduino to collect a lot of data, just how limited are you?


Yeah I'm just sort of thinking out loud, this is something I see myself running into within the next year...
6  Forum 2005-2010 (read only) / Interfacing / Re: Interacting with multiple serial devices on: January 08, 2008, 11:11:02 am
I've found the stuff about software serial... theoretically could use that for the LCD and the hardware one for the wireless... that's what I might end up doing, but I've also seen stuff (look at the Atmega168 data sheet) about serial addressing, but I don't know how it works or how to use it.

So it seems like you can communicate with a lot of serial devices (through addressing and "virtual" serial ports) but only one at a time... generally not a big deal if you set your code up right...

Since I'm doing a timing system, I can assume that for at LEAST a second after taking a reading we're not going to need to take a second one, I can ouput all the info to my serial devices (I would imagine it can do it in a second or less) then go back to listening for another signal.  Also, if I need to take information in, I can do it at that point.

That works for me, in a broader spectrum and for other applications, I don't know.

Also I still know nothing about how to actually implement all that stuff... but it seems possible.
7  Forum 2005-2010 (read only) / Interfacing / Interacting with multiple serial devices on: January 03, 2008, 01:20:39 pm
Basically, I want Arduino to output to a Serial LCD, store information  to a USB flash drive, and communicate with a computer or a second Arduino via a wireless signal.  Also it will need to have some sensor inputs and basic buttons for inputs from a user, not sure how many buttons at the moment, but at LEAST two, probably more like four.  Also possibly some LED's to light up here and there...

As I understand it, all these tasks are more or less best done through a serial connection (excluding the simple buttons and LEDs of course).

My questions:  
Is it possible? (I think it is based on addressing packets to specific hardware, but its slow?)
What's the best way to do it and/or suggestions on how to do it? (mind you I already have a serial LCD, the other hardware has yet to be purchased)

None of the serial connections need to be particularly fast, they're actually second order compared to the button/sensor inputs.  The sensor inputs are by far the most important, and need to be read as often as possible while maintaining a reasonable output to the LCD and/or wireless and/or USB.  USB data needs to be written only as fast as Arduino runs out of memory for storage.  USB data needs only to be read after all the data is collected, in fact, it might not even need to be read by the Arduino at all, but rather by a computer for simple data-logging.  Precision trumps accuracy.

In the case of using two Arduino for the wireless aspect of it.  I would need one to write to an LCD and a couple of LED's only.  The other, theoretically only would need to output to a laptop, but seeing as how I'd like this to be standalone, it would probably also have it's own LCD and also the USB storage for when our laptop invariably runs out of  battery.


For specific information on my application:
(this gets long)

This is my first project and it is relatively simple.

I need a "stopwatch" for essentially a drag racing strip, something that is triggered by one sensor at the beginning and another at the end.  Basic requirements are that the trigger is by a sensor that is much more accurate and repeatable than a stopwatch that is controlled by a person.

We actually have this system in place by wiring infrared sensors (the sort you find in a store to signal someone entering the store) into a stopwatch.  The problem we have is that at low speeds the car can trigger these sensors more than once, so we also need a debounce filter, preferably one that is even programmable for various different situations.  Also it only reads to .01 seconds, we would prefer .001

This is relatively simple and actually the LCD display and sensors have cost quite a bit more than the Arduino itself, yet the Arduino is the real key to the project...funny how that is.

Anyways, I have all the stuff to make that work and some rudimentary code in place that will get it working (will be making a thread in the 'exhibition' section within a week or two) but I'm looking towards the future...

I recognize the power of Arduino and the sorts of hardware out there, as such I've become increasingly more interested in using Arduino for a data-logging/telemetry system.

At first, this will only be recording lap data.  That is, the Arduino will only read lap times.  The first thing to do to make it more complicated is to have it read sector times, as well.  These are checkpoints out on the lap so that you know how fast you complete certain sections of the track (this is not for a drag racing strip, this is for tracks that are continuous).  A lot can be done with that data.  I would like lights to light up in the drivers face if its the fastest lap so far, or fastest section.  I would like Arduino to remember which laps were fastest.  On a more complicated level, it could do very simple data calculations such as average lap time and standard deviation.  Arduino itself only needs to remember a select few bits of information: fastest lap, fastest time for each section, average lap time, standard deviation, but all the data should be saved in a raw format to memory somewhere (USB flash drive?).  On that note, I don't know mathematically if you can calculate standard deviation and averages and all that stuff by taking a known average and standard deviation and factoring in the new lap time... I assume it's possible... worst case scenario I have it be a rolling average.  On that note, we rarely do more than 20 laps at a given time.  There will probably never be more than 5 checkpoints and/or sectors, so really there will only be about 100 pieces of recorded data in at the base level of this project.

Thats what I want to start.
In the future I see telemetry so that the driver and the pit crew see the same information (although the pit crew would probably get more detailed info, due to then not being proccupied by driving)  I see more complex data logging from a variety of sensors.  Possibly even some control over variables on the car.

Currently, I have an Arduino Diecimila.  Since things will be mounted on a race car, I will most likely be using an Arduino Mini, when the time comes.  Similarly tiny wireless devices are desired.  Range should be ~600 feet outdoors.  Less is acceptable if it can be made to send the data when it's within range and not when it's out of range (for example, sends the data when the car is driving by the pits), but not when it's 1/2 way around the track).

Thanks for your help, and taking the time to read this!

-Martin
8  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Application: Basic; Stopwatch, More; DAQ on: June 12, 2010, 10:18:15 am
I don't have access to the code anymore since this was part of a school project and I'm recently graduated (hooray!).  But it's really quite simple, and shouldn't be too difficult to figure out something basic.

Good luck!
9  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Application: Basic; Stopwatch, More; DAQ on: June 11, 2010, 08:42:17 pm
heh, no.  I was just answering the previous question.

I am aware of interrupt driven detection.  There was some reason that wouldn't work for us, I don't remember the details though :-/

It could have been that we are crappy programmers, haha smiley
10  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Application: Basic; Stopwatch, More; DAQ on: June 11, 2010, 01:28:11 pm
Yeah.

The important part is to keep output function limited, since it takes cpu cycles to update the screen, and for the most accurate measurement you want to be "listening" for the signal as much as possible.

As far as an on-board data acquisition system goes... it would be a lot trickier, we never undertook that aspect of the project, but I'm sure it could be done... to an extent.  You'd need a place to store all the data though.

Worked great as a lap timer!  Took a lot of time/energy/effort though, and first designs always have numerous bugs and issues that pop up.
11  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Application: Basic; Stopwatch, More; DAQ on: January 06, 2008, 03:12:12 pm
Quote
From the datasheet:

Text strings are limited to 80 characters and must be terminated with ASCII[255].


Yeah, I apparently missed that.
I love how missing "small" things like that can cause frustration.

working code for this ( DX160 Serial LCD ):

Here's some example code, that works with an Arduino Diecimila:


Code:
/*
 * Hello World!
 *
 * This is the Hello World! for Arduino.
 * outputs to DX160.
 */


void setup()                    // run once, when the sketch starts
{
  Serial.begin(57600);           // set up Serial library at 57600 bps
  Serial.print(186,BYTE);        // Clears the screen (DX160)
  delay(1000);                   // waits a second
  Serial.print("Hello world!");  // prints Hello world!
  delay(10);                     // waits...
  Serial.print(255,BYTE);        // sends the end-of-string command - gives the "OK" for the DX160 to print.
}

void loop() {
  
}
12  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Application: Basic; Stopwatch, More; DAQ on: January 05, 2008, 03:55:28 pm
Well I've got the LCD now and I'm having issues with it...


I  can't seem to consistently get it to work properly.  I've done a couple things and it does some stuff, but it just doesn't seem to work properly.

Either I am communicating with it in a completely wrong manner or the baud rate is not consistent enough for it...

Datasheet for the LCD I got:
http://www.sparkfun.com/datasheets/LCD/DX160.pdf

My test code, currently set to clear the LCD screen, wait a millisecond, then output the string "text horray" because if I can get it to output some text on the screen correctly, I'll be happy.


there is also a demo program for the computer:
http://www.sparkfun.com/datasheets/LCD/dx160.zip

I used that program and it works good.
I've been trying to use the TTL port.
I don't know what the program on the computer is doing that Arduino is not (also I've check the outputs from Arduino with hyperterminal, baud rate at 57600, works fine).

I was going to change the baud rate to 9600, that seems to be more standard for stuff in general, but I don't know how to software change the baud rate... don't you need to be communicating with it at a particular baud rate, send the signal, then switch to the new baud rate?  I don't understand how I would do that with the demo program they give, Arduino (since it's not communicating proerly at the moment) or hyperterminal...

So yeah, for some reason the screen isn't working properly/consistently with Arduino at the moment.  Please help!


(this is a simple modification of the debounce tutorial)

/* Debounce
 *
 * Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
 * press), the output pin is toggled from LOW to HIGH or HIGH to LOW.  There's
 * a minimum delay between toggles to debounce the circuit (i.e. to ignore
 * noise).  
 *
 * David A. Mellis
 * 21 November 2006
 *
 * http://www.arduino.cc/en/Tutorial/Debounce
 */

int inPin = 7;         // the number of the input pin
int outPin = 13;       // the number of the output pin

int state = HIGH;      // the current state of the output pin
int reading;           // the current reading from the input pin
int previous = LOW;    // the previous reading from the input pin

// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0;         // the last time the output pin was toggled
long debounce = 200;   // the debounce time, increase if the output flickers

void setup()
{
  pinMode(inPin, INPUT);
  pinMode(outPin, OUTPUT);
  Serial.begin(57600);
}

void loop()
{
  reading = digitalRead(inPin);

  // if we just pressed the button (i.e. the input went from LOW to HIGH),
  // and we've waited long enough since the last press to ignore any noise...  
  if (reading == HIGH && previous == LOW && millis() - time > debounce) {
    // ... invert the output
    Serial.print(186);
    delay(1);
    Serial.print("text horray");
    
    if (state == HIGH){
      state = LOW;      
    }
    else{
      state = HIGH;
      
    }

    // ... and remember when the last button press was
    time = millis();    
  }
  //if (state == LOW)
  //  Serial.print("text horray!");

  digitalWrite(outPin, state);

  previous = reading;
}
13  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Application: Basic; Stopwatch, More; DAQ on: January 02, 2008, 05:27:09 pm
Well I've officially got my Arduino and I just ordered a serial graphical LCD.  I don't know if I'll really be able to use the graphical part of the LCD much, but I wanted it for different font sizes.  Anyway my project's underway and I've started programming out some basic stopwatch functions.  Right now I can only really display them with LED's since I don't have the display here and handy...  I hope in short time I'll have some hard code/pictures/etc to post, in the Exhibition section, of course.


Thanks for all your help.
14  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Application: Basic; Stopwatch, More; DAQ on: December 13, 2007, 09:37:45 am
Thanks for the response.

Basically I was just looking to make sure that Arduino can handle the accuracy and basic stopwatch type inputs.  I completely agree that it should, and will be done one step at a time, that's generally how I work anyway.

When I said 8 digits maximum, what I was talking about was the accuracy of the machine (Arduino).  Or rather, what is the epsilon of the machine.  64-bit computers are accurate to 15 decimal places, stuff like that.  (how many bit is Arduino?)

Since I've never done anything like this before... Where can I get an LCD screen (7 or 8, or more, digits)?  I have access to plenty of pushbuttons, that's no problem...

Thanks!
15  Forum 2005-2010 (read only) / Frequently-Asked Questions / Application: Basic; Stopwatch, More; DAQ on: December 12, 2007, 07:20:47 pm
Hi,

As the title suggests, I have an application question...
First of all, I'm nearly positive that this will do the minimum of what I want, but I figured I'd ask anyways.

I need, at the very least, to create a "stopwatch" for a timing system for automobile racing.

The stopwatch needs to be accurate to a thousandth of a second (.001 seconds) and up to 10 minutes (600 seconds).

And that's the only real limitation I have... is the clock speed on this system fast enough for that (I would assume yes).

The reason I need this, and this is the biggest thing I need (besides the accuracy) is to have multiple-trip protection.  Frequently with our current system, if the car is traveling slow, the car can trip it two or three times when it's only supposed to do it once.  a "multiple trip" protection function is extremely important, so that it will only take one input in the span of say 1 second.  It's important that it take the first input, in this case, but that should be simple.

I'll give the minimums:
Output: mm:ss.sss (so 2 places for minutes, 5 places for seconds (3 of which for tenths, hundredths, thousandths)
so I need 7 display outputs total.
I am aware that Arduino can output that many decimal places (up to 8 with the proper hardware?).

It will need to have start/stop/reset functions that can be user controlled.
Start/stop functions also need to be able to take inputs from the sensors.
everything will run off of 12VDC (possible use of batteries can make Arduino run off of other voltage settings... whatever it likes, but run off of batteries none the less.

A lap function will also be extremely appreciated.  That is using one sensor input to start the timer, then every time the sensor is tripped it displays the time (for say 10 seconds) and resets the timer.  For the next lap.

On that note, lap # and recall of those times would be awesome.

It's worth noting that some application will be lap based (going around a track) and some will be start/stop based (drag racing).  I see doing this either with two modes, or just having the start/stop sensor in the same input ports and either using one sensor or two, depending on the application.

Storage of values or uploading values to a computer would be nice.  Storing then uploading would also be nice.  Ability to put in info for datasets would be nice (for example, put in the name of the driver for each lap set).

Sector times would be very nice.  That is, you have a sensor for the start/finish of the run, and other sensors at other spots in the track.  It measures the lap time relative to the "main" lap sensor, and also time in between each sensor.  I have 5 sensors at the moment.

On software side, some data anlysis would be nice.  when uploaded to computer, it could find fastest lap (and with sector times, fastest rolling lap (this analysis uses each sector gate as a start/finish instead of a checkpoint, it then finds the fastest lap, which might have started/ended in the middle of the track, but due to being slow before or after that point, would not show up as being as fast under normal circumstances... I hope that is an adequate description)).

Also plot histograms of data and maybe do some more complicated analysis.


This is the first part of what I want.  A piece of harware that only really measures time between sensor trips with some flexibility to filter out multiple trip errors and the like.  It would not interface with the car at all.

Depending on how easy/doable/flexible this project and Arduino is in general, I'm sure I could come up with boat loads of other applications, all the way to DAQ and in-car driver instrumentation.  Maybe even telemetry stuff?

Last but not least... a recommendation of what hardware to get would be nice.


Cheers!

-Martin
Pages: [1]