Show Posts
Pages: [1] 2 3 ... 746
1  Using Arduino / Project Guidance / Re: Vision System Program Architecture - Fio V3 on: Today at 08:37:30 pm
Fundamentally I struggle with how to emit a 30KHz pulse while at the same time scanning for it?

Have you got an IR receiver which will detect the 30KHz signal for you and tell you whether it's present? This isn't something you really want to do for yourself.
2  Using Arduino / Project Guidance / Re: Log FuelFlow -Reading 4 frequency inputs (digital on/off) and logging to SD card on: Today at 01:24:19 pm
In this new version I changed the pgenPreviousMicros to static unsigned long as you suggested, but to no effect, apparently. pgen is still not working.

I don't see that change in the version you attached.

The basic use of nowMicros in pulseMeasure() looks OK, but I think there is a problem due to the fact you're using it in a FOR loop. It would probably work by mistake. I would expect it to detect (nowMicros - previousMicros > 1000000) is true for the first element in the loop, write the entry to the log and then update previousMicros so that the condition is no longer true for the subsequent loop iterations. The SD output shouldn't be inside the FOR loop, should it?

Code:
unsigned long nowMicros = micros();
for (int i = 0; i < qty; i++)
{
    digital read, change detection, pulse length calculation, flow rate calculation, update cumulative total
}
if (nowMicros - previousMicros > 1000000UL)
{
    previousMicros += 1000000UL;
    write stats to SD
}
3  Using Arduino / Project Guidance / Re: average noise level on: Today at 09:13:59 am
There have been Arduino projects in the past that did sound spectrum analysis. You should be able to find them in the playground, or ask Google. I suspect what you're trying to do here would be simpler and the existing projects would do most of the work for you.
4  Using Arduino / Project Guidance / Re: Water Gun Race - Is it doable? on: Today at 09:11:58 am
I suggest you start by deciding what sort of water pressure and maximum volume flow rate you need, then spec the water supply for that. If at all possible I would use low voltage DC for everything because mains voltage electricity plus water spraying about is a recipe for disaster. What ever else you do, if this thing is powered from the mains in any way make sure you power it through a residual current detector (RCD) isolator.

Assuming you want to allow multiple 'guns' to be used in the same game, I'd eliminate the solenoids and just give the user a hand trigger, the sort of thing commonly seen on garden hoses - and if it suits your game design, I'd aim to use standard garden hose spray heads with a suitable nozzle. That way you can turn on all the guns together by turning the pump on, or opening the valve to your pressure accumulator. I don't know how much water you plan to dispense per game, but an ordinary garden pressure spray container would make a convenient pressure accumulator.

The electrical and software side should be fairly simple, but you can't finalise it until you have sorted out the hardware side and decided what sort of pumps and valve actuators you need.

To detect water hitting the target, you could just use a paddle that operates a microswitch when a water jet impacts it.

To detect the water level in your measuring device, I would use a switch activated by a float. Make the float something visible and you can use that to show the progress of each player during the game.
5  Using Arduino / Project Guidance / Re: Vision System Program Architecture - Fio V3 on: Today at 08:55:42 am
There seem to be two parts to the problem: generating the 30KHz signal on one pin at a time, and detecting and handling the returned signal. I guess the receiver will automatically detect the 30KHz signal when it is present, and you just need to monitor its output state. If you need to detect the 30KHz modulation yourself that will be more complex and you should probably be looking for an IR receiver library.

You seem to be planning to use interrupts for both parts. Unless you are already very familiar with using interrupts, I suggest you don't. It is a common misconception that you need interrupts in order to control multiple independent activities, but you don't. There are situations where interrupts are necessary to achieve particularly low latency in responding to an input event, but it's not obvious that's the case here. Using interrupts introduces significant design issues and is best avoided unless/until necessary.

To generate the 30KHz output you could do it entirely in software, or using a timer interrupt handler, or entirely in hardware. The first approach would be by far the easiest and simplest - just take the guts of the 'blink without delay' example sketch. The disadvantage of this approach is that you can't afford for your sketch to do anything else that will keep the CPU busy for longer than half your pulse duration - I don't know what else you intend it to do so I don't know how much of a problem that will be. Using a timer interrupt handler to schedule the 30KHz signal but doing the actual output in software would increase the complexity but reduce the CPU requirements. This would be a good compromise if you need to keep the CPU available for other things - the Timer library would be a good way to implement this approach. Doing it entirely in hardware would reduce the CPU load further but mean you need to work with the hardware timers at a lower level, which means you have a steeper learning curve. I suggest you take the easiest / simplest approach first, and move to the more complicated approaches if you find it is necessary.

The most appropriate way to handle the receiving side depends to some extent on how frequently you expect to switch emitters i.e. how much latency you can afford here. Assuming that you're going to let each emitter run for at least milliseconds and perhaps tens of milliseconds or longer, simply polling it's output at regular intervals shorter than the switching interval should be sufficient, and again you can do that either entirely in software (simplest) or using a hardware interrupt and then providing a mechanism for the interrupt handler to notify the code running in the main context about the detection - which will usually involve the main context polling some shared data. Having the main context simply poll the detector directly avoids a lot of complexity and issues associated with the use of interrupts, but using an interrupt handler to set a flag per detector and then polling and resetting the flags in the main context wouldn't be a lot more complicated. It's a trade-off between how keen you are to avoid complexity, versus how keen you are to avoid loading the CPU.
6  Using Arduino / Project Guidance / Re: How can i take the best sensor values ? on: Today at 08:28:54 am
I think you'd need to know what sort of sensors they were, what environment you were in and what locations in that environment you wanted to taker readings from. Certainly the Arduino can make a servo move, but whether that achieves anything useful for you I have no idea.
7  Using Arduino / Programming Questions / Re: Webcam on: April 17, 2014, 08:45:17 pm
The critical factor will be choosing a MiFi device that supports a mobile network that is available in your environment and that offers an acceptable data contract. You also need to ensure that it has the capability to accept incoming connections from the wide area network. If it supports uPNP then that shouldn't be a problem.

How you set it up will depend on the particular device you choose - so will your options for powering it.

The IP web cam should be far less problematic and you should just need to select one with the features you want provides a network interface that matches the MiFi unit i.e. WiFi or Ethernet, and supports uPNP if your chosen MiFi unit needs that to support incoming connections.
8  Using Arduino / Programming Questions / Re: Boat autopilot - PID not centralizing rudder. on: April 17, 2014, 05:53:06 pm
 smiley-razz
9  Using Arduino / Programming Questions / Re: Creating a Web Server: Multiplexer & Ethernet Shield on: April 17, 2014, 05:48:31 pm
What IP address has your UDP server actually bound to?

Have you confirmed that devices in the subnet your Arduino is in can reach the subnet that your server is in?

I'm trying to use UDP packet from my Arduino. That's the only way I'm aware of to send data from my Arduino and Ethernet Shield.

You can use any TCP/IP or UDP/IP protocol. UDP can work (assuming you have provided IP connectivity and implement the client and server correctly) but it's far from the only option.
10  Using Arduino / Project Guidance / Re: reading from 4 SoftwareSerials one after another on: April 17, 2014, 05:39:15 pm
Perhaps there's something wrong with your code. However, that snippet isn't enough to show what you've done wrong. Please post a complete sketch that demonstrates the problem. If your sketch includes a lot of code not relevant to the problem I suggest you create a minimal sketch that demonstrates the problem in the simplest way you can think of. Quite often, just creating that will enable you to solve the problem for yourself. Even if it doesn't, you've still reduced the amount of code we need to wade through to understand your problem.
11  Using Arduino / Project Guidance / Re: A network of Arduinos reporting to a central device or computer? on: April 17, 2014, 05:35:17 pm
This would all be wired. There are half a dozen sites spread across 5 counties, about 35 miles at most, with microwave LAN bridges that use 802.11g over 900mhz diplexed onto the FCC licensed 950mhz band. But for the purpose of answering the question: it's "wired". =-)

Also, at its max there would be a maximum of maybe like 18-20 remote Arduinos.

If you can provide access from each LAN to the public internet, and allow access from the public internet to a management station which can receive the incoming data, then the communication part becomes a simple TCP/IP design issue.

If you can't establish TCP/IP connectivity then the problem will be harder.
12  Using Arduino / Project Guidance / Re: interfacing Jpeg colour camera C329 with Arduino mega 2560 on: April 17, 2014, 05:28:27 pm
PeterH : kind of broken..! i have searched it but was not able to fetch some useful data regarding my task that's why i posted something here...

That's peculiar, because when I search for c329 arduino I get tons of hits. I don't suppose they're all directly relevant, but I feel sure that somewhere in all this information is an explanation of how to interface a c329 camera with an Arduino:

New Arduino Library for our C329 UART cameras!!!
C329 Camera and Arduino test fixture.
C328 and C329 Cameras
C++ library for the C329 SPI camera module

That's just the top few of about 15,000 results.
13  Using Arduino / Project Guidance / Re: Github question? on: April 17, 2014, 05:16:36 pm
everytime the arduino or clone starts up, it updates the code from the repo?

You mean you want the Arduino to install an updated sketch on itself? That would have to be done through something else. Assuming what you put on Github is the source, you'd need to have some application running on another device acted as a manager it would need to detect the source updates, recompile the sketch and then decide when to upload it to the Arduino. If you want that upload to be triggered by an Arduino reset it would require the Arduino to notify the manager device that it has started up (and presumably which version of the sketch is running), so that the manager can decide whether it needs to be updated. There are build tools specifically designed to keep a built application up to date relative to a repository and other tools designed to manage the deployment as the application is updated, so if you wanted something fancy that would all be feasible. But for a simpler solution you could just update the source hierarchy on a scheduled basis and use make to decide when to rebuild it, and then have a DIY application that worked together with the sketch to work out what version of a sketch is running and perform the upload if necessary.
14  Using Arduino / Project Guidance / Re: Log FuelFlow -Reading 4 frequency inputs (digital on/off) and logging to SD card on: April 17, 2014, 10:52:40 am
The pgenPreviousMicros variable in pgen() needs to be declared as a static variable, so that it keeps its value between calls. (Otherwise it will be allocated automatically on the stack and the value will be discarded when the function returns.) This change is important because pgen() won't work correctly without it.

Code:
static unsigned long pgenPreviousMicros = 0;

Given that your logging is only done once per second, using micros() to time it seems overkill. I would use millis() unless you need the extra resolution of micros(), although what you have ought to work.

The update to previousMicros is in the right code block now. Personally I'd prefer to put it at the top of the block (next to the 'if' statement that is doing your elapsed time check) so that it is more obvious that it is updated correctly, but it won't affect the behaviour.

To eliminate the redundant calls to micros() you would save the value of micros() in a variable somewhere near the start of the function.

Code:
unsigned long nowMicros = micros();

Then you would use the currentMicros variable throughout the rest of the function where you had calls to millis(). I wouldn't expect this change to make much difference to the functionality but it just eliminates the possibility of inaccurate timing if the value of millis() changes while this function is running.

I haven't spotted the dataString statement that you asked about.
15  Using Arduino / Project Guidance / Re: two water pump project for newbie on: April 17, 2014, 09:17:22 am
I would like to do:
+ Switch on & off two water pumps by a button without computer (no USB connected)

It seems to me that you could achieve this very simply by using the switches directly to turn the pumps on and off - what makes you think there is any need to involve a microcontroller?

it's has to run automatically as an installation

I don't know what you mean by 'run automatically' i.e. what it needs to do when it's running. Your original description was very simple:

Quote
I would like to do:
+ Switch on & off two water pumps by a button without computer (no USB connected)
If that's accurate and you just want to have the pumps turn on and off by a button, the Arduino is redundant.
Pages: [1] 2 3 ... 746