Show Posts
Pages: 1 ... 32 33 [34]
496  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: How Fast is it? on: May 30, 2008, 03:34:31 pm
Quote
1 - How long does it take to startup (with/without writing a new bootloader)
2 - HOw fast can it pulse an I/O pin? If I put it in a tight loop - what kind of freaquency will it pulse? I am shooting for 7kHz.
Startup time will depend on the clock fuse settings (I don't know off-hand what these are for the Arduino, but it's not hard to look it up) and what the bootloader does (this is something I have no familiarity with).

On a 16 MHz mega168, you can pulse an I/O pin at maybe 2 - 4 MHz, depending on the implementation and how important it is to have a specific duty cycle.  On an Arduino you won't be able to achieve such high speeds just because of the overhead associated with loop().  Just jumping into and out of the subroutine incurs a relatively large delay (large compared to the time it takes to set an I/O pin), and I'm not sure if there is any other substantial overhead occuring outside of loop().  Nonetheless, 7 kHz is quite slow, so you would have no problem achieving this on an Arduino.

- Ben
497  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: electromagnet on: May 25, 2008, 04:32:00 am
The simplest way would probably be to use an I/O line to control a MOSFET or transistor that switches power to your electromagnet (as an I/O line by itself will probably not be able to source the current needed to drive an electromagnet.

- Ben
498  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Using a pushbutton as a clock on: May 30, 2008, 02:37:01 am
If you can figure out the period of the bouncing, you can send the pushbutton output through a low-pass (RC) filter with a similar time constant, then use this filtered signal as your clock input.

- Ben
499  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: using arduino for an art project, need rundown on: May 16, 2008, 12:55:24 pm
Hello.  If you're talking about a brushed DC motor, you would need a motor driver or a motor controller.

Motor drivers are the simplest modules in the sense that all they do is provide power amplification for low-level control signals (e.g. PWM and direction) supplied by the user; on the other hand, that means that the master device to which the motor driver is connected must take care of the low-level, resource-consuming signal generation.

Motor controllers are motor drivers with additional intelligence: an on-board microcontroller generates the low-level signals and presents the user with higher-level interfaces and commands. For example, our micro dual serial motor controllers allow two DC motors to be controlled by a single serial line, and the master controller simply issues commands only when the speeds of the motors should be changed. Other motor controllers are even more complex, incorporating advanced acceleration commands, current sensing, feedback-based control, and more.

The specific motor driver/controller you need will depend on the motor you get (e.g. its stall current) and the voltage at which you plan to run it.

- Ben
500  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Interrupts and Bouncy buttons. How to Solve?? on: May 13, 2008, 03:18:13 pm
Quote
Being a hardware sort of bloke I would simply put a capacitor across the push button. It's not too critical but a 0.1uF usually does the trick. That way you solve the problem at source.
I think this solution would depend on what your entire circuit looks like.  Without a pre-specified R part of the RC filter, the timescale of your capacitor's discharge (e.g. microseconds) could potentially be much shorter than the timescale over which the button bounces (e.g. milliseconds).  Just something to watch out for.

- Ben
501  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Interrupts and Bouncy buttons. How to Solve?? on: May 11, 2008, 10:03:49 pm
Quote
Could you have the interrupt fire when the button first presses, then instead of callcing delay() for a period, DISABLE altogether interrupts for the smae amount of time? This would mean that the bouncing interrupts would be ignored, then you can re-enable interrupts in time to catch the next push.

Not sure how this would affect other bits of your code that may also rely on interrupts e.g. PWM. There is a lot of discussion somewhere on the forums in relation to this.
Even better than this would be to disable only the interrupt tied to the button for a duration that's longer than the bouncing period.

- Ben
502  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re:   library function for timer/counter modu on: May 13, 2008, 12:35:19 pm
Quote
Bens, I'm glad to see you're sticking around.  I can't wait to see what libraries you come up with.
This seems like a great community; I'm very happy to be here, share some of the things I've learned, and pick up some of the things that are new to me!

- Ben
503  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re:   library function for timer/counter modu on: May 13, 2008, 12:32:56 pm
Quote
sir,
  Thankyou for your valuable suggestion.Now i using  winavr.I hav compiled a program with no errors.
but one problem . i cant use simulator debugging , as i already selected AVR simulator as platform and
ATmega8 as device. It shows runtime rerror .Can i able to debug step by step in winavr without connecting the programmer( hardware).
I'm not sure I fully understand.  Are you still using the Arduino IDE or are you now bypassing that in favor of straight WinAVR?  Do you have an AVR ISP programmer?

- Ben
504  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re:  library function for timer/counter modul on: May 12, 2008, 12:40:25 pm
I'm not really familiar enough with the Arduino environment yet to know what you can and can't do, but avr/io.h defines all of the mega8 register locations you need.  You shouldn't have to do anything like:

#define TCNT0 0x32  // this line is unnecessary!!!

By looking at the mega8 datasheet, I can see that your code should look something like this:

void setup()
{
  TCNT0 = 0;
  TCCR0 = 0x07;  // External clock source on T0 pin. Clock on rising edge.
}

void loop
{
  // connect your clock input to PD4
  // on a regular basis check the register TCNT0 to see how many clock pulses have occurred?
  //  for example:

  if (TCNT0 > 100)
    do something fun;
}

- Ben
505  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re:  library function for timer/counter modul on: May 09, 2008, 01:30:29 pm
I don't know about a library function, but you could do it with something like:

TCCR1B = 0x07; // timer1 clock = external clock source on pin T1, rising edge

Connect your external clock to mega168 pin 9 (a.k.a. PD5/T1, a.k.a. arduino pin 5).  Every rising edge of your external clock will increment the timer1 count register TCNT1 by one.

- Ben
506  Forum 2005-2010 (read only) / Bar Sport / Re: 120,000 hz arduino only oscilloscope? on: July 03, 2008, 04:44:05 pm
Quote
1. does the hardware behind analogRead need to be blocking?
I don't understand what you're asking.  The mega168 only has one ADC, which means you can only be performing a conversion on one channel at a time.  While the conversion is going on, the ADC hardware is by definition busy, but this does not occupy the processor in any way.

Quote
2. Does the performance of an analog read improve with a faster clock rate?
The ADC has its own clock (a prescaled version of the system clock).  To get maximum resolution (i.e. 10 bits), the ADC clock must be between 50 and 200 kHz.  If you don't need maximum resolution, you can run the ADC faster than 200 kHz, but the faster it is, the lower the resolution.  Note that the analog-to-digital conversion takes 13 ADC clock cycles while the ADC is running normally and 25 clock cycles to initialize the ADC and perform the first conversion.  This means that if you want maximum resolution, you will have a sample rate of around 15 kHz.

Quote
3. and if(!1) can you gang the analog read pins together and not have the reads interfere with each other if triggered at different (overlapping) times?
No.  The ADC spends nearly its entire conversion time measuring the voltage on the channel for which it is set.

Quote
I'm just wondering because it seems that if you put the fastest crystal the atmega can stand (say 32mhz)
The fastest the mega168 can run (according to its spec) is 20 MHz.  If you run it faster than this it might work (or seem to work, but it is out of spec and could lead to all sorts of obscure problems.

- Ben
507  Forum 2005-2010 (read only) / Bar Sport / Re: battery wattage on: June 16, 2008, 10:45:44 pm
AAs are the same as AAAs (same voltage, same chemistry for the same battery type) except that AAs have more capacity (i.e. more amp-hours).

- Ben
Pages: 1 ... 32 33 [34]