Show Posts
Pages: 1 ... 11 12 [13] 14
181  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Timer Trap on: April 14, 2008, 04:55:17 am
Quote
WHAT'S NEEDED:
A circuit that will accept the first ON/OFF pulse and ignore everything else.

You can do this in hardware or software - in hardware, you can use a d-type or a jk flip-flop.  Have a, "arm" button which initialises the circuit, then when the sensor state changes the flip flop changes state again and can't revert back unless armed again.

In software it is the same. Have an "arm" button. When pressed sets a variable to "armed". You only take notice of the start sensor level changed when "armed". As soon as the sensor level changes set the "armed" variable to "triggered" so that any further level changes will be ignored.

Doing it in software is favourite, in my opinion, as there are no parts to buy and it affords some flixibilty.

Mike

182  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Timer Trap on: March 23, 2008, 02:00:23 pm
He he.

The 555 was the very first IC I bought - I saved up my pocket money, cycled 25 miles to buy the thing from a little electronics retailer, cycled 25 miles home then put together a little circuit to flash an LED.

I never did get the LED to flash, but I did turn the 555 into a smoke generator!

Mike
183  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Timer Trap on: March 23, 2008, 05:11:05 am
why not use the Arduino to time it? you don't need an additional oscillator.

If you are happy with milli-second accuracy, you can use the millis() function: grab the millis() value when the race starts and again when the laser beam is broken and subtract one from the other and display it.

The time will be more accurate than can be achieved with a 555.

Mike
184  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Timer Trap on: March 19, 2008, 11:27:32 am
hole shot - that's the first to thru the first corner, right?

If the race controller has a start gate that drops, fitting a switch to that would be good.

As for the end sensor - a bright LED shining on a sensor and reflecting back (so you don't have wires going across the track would work.

Then, just count time between one and the other.

Additional ideas:
 - use infrared leds so sunlight dosn't swamp the sensor.
 - consider modulating the light from the leds for better noise rejection

Mad ideas:
 - Have the start and end boxes connect using a wireless system, like xbee
 - have the led sensor trigger a camera to capture the rider getting throught the corner.

Nice little project smiley

185  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Controlling Arduino with Bluetooth Phone on: April 08, 2008, 09:44:28 am
I think you're going to have to write a java app to run on the blackberry (if it runs java).

I believe someone round here has done something like this with a Nokia N70.
186  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Controlling Arduino with Bluetooth Phone on: April 05, 2008, 01:54:49 pm
Sparkfun do a Bluetooth modem which can be connected to the arduino using RS232 type serial.

http://www.sparkfun.com/commerce/product_info.php?products_id=582

It uses the serial port profile (SPP). Does your phone support SPP?

Mike
187  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: send bluetooth message to phone on: April 08, 2008, 04:28:15 am
I haven't done this yet - it is part of my project - but you use the obex push mechanism.

The phone won't need any extra config. That is, if it can accept a file from another phone via Bluetooth, it won't need anything else.

Mike
188  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: send bluetooth message to phone on: April 07, 2008, 11:40:50 am
Yes it is. What kind of messages do you want to send?

The tricky bit is the size of your messages - there is not alot of memory on the AVR. If the Arduino is to run standalone (ie not just operate as a PC peripheral) you may need to add on some extra memory.

Mike
189  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: fading 4 leds in a row with digital output on: March 17, 2008, 03:57:43 pm
Yeah - there are some good people here.

This is what I came up with - software PWM led dimmer without Delay():

Code:
#define ON HIGH
#define OFF LOW
#define ledPin 13
#define pwmPeriod 20

int value = LOW;                // previous value of the LED
unsigned long previousMillis = 0;        // will store last time LED was updated
unsigned long ulMillis = 0;
unsigned long interval = 1;           // interval at which to blink (milliseconds)
int ledVal = 0;
int pwmCount = 0;
int ic = 0;

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  ulMillis = millis();
  if (ulMillis - previousMillis >= interval) {
    previousMillis = ulMillis;
    
    pwmCount++;
    if (pwmCount > pwmPeriod) {
      pwmCount = 0;
    }
    if (pwmCount > ledVal) {
      value = OFF;
    } else {
      value = ON;
    }  
 
    digitalWrite(ledPin, value);
    
    ic++;
    if (ic>333) {
      ic=0;
      ledVal = random(pwmPeriod)-1;
    }  
  }
}

It works on a 20ms period and can display 20 different brightness levels.

Every 333ms it changes the led brightness to a random value.

As the Delay() function is not used there are no wasted clock cycles and other things can be done. For example, it would easily handle more leds and could handle a keypad (with debounce) whiich could control brightness of the leds.

Mike

190  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: fading 4 leds in a row with digital output on: March 16, 2008, 02:04:58 pm
Hi Nabisco,

You could use the technique shown in here:

http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay

you might also look at using a timer interrupt.

Mike

191  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: fading 4 leds in a row with digital output on: March 16, 2008, 07:27:23 am
Quote
Well, up for the challenge I decided to have my own go at PWM!

Here's the result (and it only took 5 minutes! - I'm impressed since I've only been playing with Arduino for a day now)

{ Code snipped }

My LED flickers a bit though. I am thinking this is because my software PWM works slower than hardware PWM?

That's good work, Nabisco. There is a little flicker, which is probably to do with the period.

Delay() wastes so much processor time - how about trying to do it without using Delay()?

Regards,

Mike
192  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: fading 4 leds in a row with digital output on: March 14, 2008, 08:49:29 am
One way to do this is to vary the time that the LED is on, but do it so fast the eye can't see the LED in the off state.

For example, if you were to want the LED at 90% brightness and assuming a repeating time of 10ms, you would switch the LED on for 9ms then off for 10ms then repeat over and over.

This is called pulse width modulation (PWM).

The arduino has some facilities for PWM which may help, but it isn't too hard to code this yourself for 4 LEDs.

Mike

193  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Languages for programming the Arduino on: March 14, 2008, 07:20:08 am
The Arduino IDE uses C and C++.

There is a gnu C/C++ compiler for the Atmel AVR range of microcontollers. The Arduino IDE uses this simplifying its setup.

You can use the same compiler if you know how to set it up and write and use code for the Arduino boards.

Mike
194  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: waterproofing on: January 07, 2008, 05:40:20 am
I have used bath sealer in the past.  It is not spray-on, but it is an alternative to epoxy.

Mike
195  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Using the Bluetooth module on the ArduinoBT on: January 10, 2008, 01:47:09 pm
It would appear to not be the EEPROM. In the code I posted, I added a array of 512 bytes and wrote to that instead of the EEPROM - I still get the errors.

(I guess I'm assuming that writing to an array in internal SRAM is quicker than writing to EEProm.

Regards,

Mike
Pages: 1 ... 11 12 [13] 14