Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 290
61  Using Arduino / Project Guidance / Re: reading 1000ths of a seconds from a pcf8583 rtc on: August 11, 2014, 05:18:49 pm
you have lost me am reading about prescaler but all double dutch will need to improve my knowledge further.

Timers are pretty neat, and even fairly straightforward once you get them figured out a bit.

There's a tutorial here that really helped me get started:
http://www.fourwalledcubicle.com/AVRArticles.php

And of course Nick Gammon's site:
http://www.gammon.com.au/forum/?id=11504
62  Using Arduino / Project Guidance / Re: reading 1000ths of a seconds from a pcf8583 rtc on: August 11, 2014, 04:53:38 pm
so am I right in thinking the best timing a arduino can do is 4 microseconds then.

Given a 16MHz system clock (Uno, et al.), one clock cycle is then 62.5 ns. The internal hardware timers can be configured to count at this rate. Of course there are tradeoffs (e.g. the counter will overflow rather quickly, being only 8 or 16 bits). The input capture unit can be a nice approach in many applications. Basically an external signal causes the current timer count to be captured in another register, and this event can trigger an interrupt, etc.
63  Using Arduino / Project Guidance / Re: reading 1000ths of a seconds from a pcf8583 rtc on: August 11, 2014, 03:57:42 pm
this is the code I am using it flops over at 60000000micro's later but it flops at 60000004micro's later??

can anyone explain it?

Sure can, read this, third sentence:
http://arduino.cc/en/Reference/Micros

PS: Also note that micros() returns an unsigned long, so variables like starttime, timeout, exittime should also be unsigned long.
64  Using Arduino / Motors, Mechanics, and Power / Re: Wiring Arduino Micro with Xbee Radio on: August 11, 2014, 03:48:35 pm
Hello,
I will like to know if there is a way to lift a person with arduino. If there is which arduino & which motor should I use? Would I need a battery? What RPM will I need to reach?

Thanks,
David

Hi David,

You should probably create a new post, and probably in a different forum section. As a reply in this thread, it is way off-topic. First, please have a look at this for some tips. Take special note that a post should not be made in more than one section of the forum.

I'm sure that what you want to do is possible, but your inquiry is too broad to say much more so I might either narrow it down, or explain more about what exactly it is you are trying to do. For example, probably pretty much any RPM will work, depending on how much of a hurry you are in and what gear reduction is available.

Welcome to the forum.
65  Using Arduino / General Electronics / Re: Wiring Arduino Micro with Xbee Radio on: August 11, 2014, 01:40:34 pm
Smart thing is to add (a) function(s) to the library that doesn't turn the pullup on then and use that?

The pin will still be at 5V when driven high by comms. I'd go with the MOSFET if it were me.
66  Using Arduino / General Electronics / Re: Wiring Arduino Micro with Xbee Radio on: August 11, 2014, 01:13:30 pm
My thinking is that AVR INPUT_PULLUP current is through 20k-50k ohms, the 3.3V device should be able to take that below 1V without much problem. Maybe the .7V drop through the diode helps?

That's what my gut tells me too, but not so. It's about the voltage when the pin is high, not current when it's low. They're slicing things so thin these days (in a figurative sense, there's no slicing going on, but the transistor structures are extremely thin) that 5V can cause a breakdown when 3.3V won't. Electric field strengths (measured in volts/meter) can get pretty impressive when the size of the structure is measured in nanometers.
67  Using Arduino / General Electronics / Re: Wiring Arduino Micro with Xbee Radio on: August 11, 2014, 10:15:31 am
Can't use a diode like on the MCU-to-XBee line, because the XBee will still have to pull down the 5V. I'd go with a MOSFET level shifter like this.
68  Using Arduino / General Electronics / Re: Wiring Arduino Micro with Xbee Radio on: August 11, 2014, 08:52:01 am
Well it looks like SoftwareSerial enables the pullup resistor on the RX line:
https://github.com/arduino/Arduino/blob/master/libraries/SoftwareSerial/SoftwareSerial.cpp#L368
69  Using Arduino / General Electronics / Re: Wiring Arduino Micro with Xbee Radio on: August 11, 2014, 06:29:59 am
3) I can send data from Arduino to Xbee#2 connected to laptop. The voltage at pin DOUT (pin 2) of Xbee#1 (connected to Arduino) is around 4.8V. Is it ok?

Not OK. XBee is a 3.3V device and is not 5V tolerant. How is it being powered? Not sure how the DOUT pin could be that high if it's connected to an input pin on the Arduino unless the XBee is being powered by more than 3.3V.
70  Using Arduino / Programming Questions / Re: Timer 2 - Clear counter without adding delay to the count on: August 10, 2014, 03:35:53 pm
This generally means measuring the period between two consecutive pulses. For example at 1Hz I have a 1Hz refresh rate, but as the frequency increases so does my refresh rate. Technically speaking anything with less than 10 samples a second is useless and I aim at having about 100 samples per second.

Understood, but "generally" is a bit fuzzy. With a 1Hz input, we can't do 10 samples/second. At lower frequencies, I assume it must be OK to just do the best we can, i.e. time one cycle. At the other end of the spec (2048Hz) timing one cycle will generate a lot more than 100 samples/sec. So there's another requirement here for the sampling frequency, has that been codified? If 100 SPS is OK at 2048Hz, the code could sample 20 cycles of the input. Or it could sample one cycle, report that, and skip 19 cycles. Maybe the sampling interval is always 100ms except at input frequencies below 100Hz, then it's one cycle. So a hybrid approach. Sounds now like this is not a frequency counter at all, i.e. it doesn't count cycles, but it measures the period and reports the inverse (frequency). Still looks like a frequency counter on the outside but the measurement technique is different.

I'm not writing code yet, still trying to understand the requirements smiley-wink
71  Using Arduino / Programming Questions / Re: Timer 2 - Clear counter without adding delay to the count on: August 10, 2014, 12:33:31 pm
@casemod, no worries, I know what you mean. Sometimes things do get frustrating, and sometimes on both ends of the stick.

Anyhoo, here is a frequency counter library I did and here is an example sketch. It uses an external 1 Hz signal for the time base which happened to come from a GPS but could just as easily be an RTC. For that matter, I suppose it could be from another timer configured to generate an interrupt at 1 Hz. Don't think Timer2 can run that slow, but it could generate 125 Hz interrupts, which I think could be made to work.

Have a look, does it meet your requirements?
72  Using Arduino / Programming Questions / Re: Timer 2 - Clear counter without adding delay to the count on: August 10, 2014, 08:55:57 am
The original goal is to measure a frequency ranging from 1 to 2048Hz in steps of 1Hz.

In order to achieve such precision the minimum sampling period must be 2048 cycles, therefore as time between each consecutive pulse doubles I need to count a total of 2048^2 = 4194304 pulses per second.

Excellent, that is the problem statement that we were looking for. I would not have guessed that to be the goal from all the conversation thus far.

There are several frequency counter sketches around, I assume you've looked into them?
73  Using Arduino / Project Guidance / Re: reading 1000ths of a seconds from a pcf8583 rtc on: August 10, 2014, 06:55:19 am
-the timing system shall display the time down to at least the hundredth of a second (xxx.xx) to 2
decimal points
- the timing system shall be accurate to within 3ms over 60 seconds (50 ppm)
- the timing system shall provide the same timing for both lanes to within 2ms over 60 seconds

Good, this describes both the accuracy and the resolution needed. But, the 3rd point is redundant and somewhat conflicting. The 2nd point says accurate to 3ms, the 3rd point says 2ms. Not exactly sure what the words "shall provide" mean, especially given the requirement to display to 0.01 second.

I am aware of several RTCs with 0.01 sec resolution but none that provide 0.001. Since time of day is not needed, as pointed out above, one solution would be a custom Arduino-compatible board with a decent crystal, say 20ppm. I've designed and built several of these and they do indeed run within spec. Then one of the internal timers could be set up to give interrupts at 1000Hz, which would provide the time base. Use the external interrupts for the start and stop for each lane.

If a custom board isn't an option, then an external oscillator with the required accuracy will be needed, as an Arduino's ceramic resonator isn't good enough. This most likely will not be an RTC; while many can provide various frequency square waves, the frequencies are usually powers of two. (Although I suppose computational games could be played to come close enough, similar to the way millis() works.)
74  Using Arduino / Programming Questions / Re: Timer 2 - Clear counter without adding delay to the count on: August 10, 2014, 06:30:23 am

Forget timers, forget clocks, just explain what you actually want to achieve at
a high level - there may be better ways to achieve what you want.

Reply #9 has a detailed explanation regarding the problem

Reply #9 has somewhat of an explanation of the current solution, which evidently leaves something to be desired. Explain the original goal, not the problem with the current implementation. In fact, leave details of the current implementation out completely.
75  Using Arduino / Programming Questions / Re: Timer 2 - Clear counter without adding delay to the count on: August 09, 2014, 08:15:20 pm
Given the formula, the prescaler has nothing to do with that. The counter value has to be multiplied by 256 when using Timer 2, and by 65536 when using Timer 1.

Yes.
Pages: 1 ... 3 4 [5] 6 7 ... 290