Show Posts
Pages: 1 2 [3] 4 5 ... 748
31  Using Arduino / Project Guidance / Re: Quadcopter build on: April 19, 2014, 08:23:40 am
I am also seeking advise for propellers and battery sizes. Also information on calculating thrust would be nice

I suggest you ask these questions on one of the many forums that specialise in DIY drones.
32  Using Arduino / Project Guidance / Re: A network of Arduinos reporting to a central device or computer? on: April 19, 2014, 08:20:01 am
TCPIP is already established to the remote sites. Public internet is not needed, and is not an option for security reasons, that was the purpose of establishing private FCC-licensed IP links. The remote sites are subnetted as part of the LAN. Latency is usually less than 10ms. In fact it's fast enough that we use it for streaming audio and VOIP for phones at some sites, with nearly undetectable codec delay.

That's ideal. In that case I would just use an Ethernet-capable Arduino at each remote site and use a TCP/IP client/server architecture for the comms. In the simplest case each remote would acquire the data and make one attempt to transmit it to the central collector, and the collector would just store whatever it received with no resilience, authentication, encryption or access controls. If that's sufficient, the implementation would be straight forward.
33  Using Arduino / Project Guidance / Re: Automatic plant watering system on: April 19, 2014, 08:13:33 am
I am unsure on what kind of pump should I be using for this project

It needs to provide the water flow rate and pressure tat you want, and there must be a compatible driver circuit that you can use to drive it. If you're talking about watering individual small plants then you don't need much flow or pressure and you can probably get away with a small DC micro pump. These are available running off anything between 3V-12V and only take a couple of hundred mA which makes them convenient to drive using an L293 or L298 based driver circuit. That could be a motor driver shield on a standard Arduino, or a clone such as the Baby Orangutan with the motor driver integrated. If you run it from a 7-12V supply, you can probably use the same supply to power the Arduino.
34  Using Arduino / Programming Questions / Re: How do I move a sequence through an array? on: April 18, 2014, 09:56:38 pm
Or I could just make them like this.

No, that isn't a good approach. The length and the highest index are different things, and trying to pretend they are the same is a bad idea. Just stick to the length being the number of elements and using an inequality for the upper bound in the for loop and it works fine.
35  Using Arduino / Programming Questions / Re: getting else without previous if error on: April 18, 2014, 09:53:19 pm
Everything after 'else' is probably spurious:

Code:
else ((value = 0) && (value >= 251));
36  Using Arduino / Programming Questions / Re: data transmission nrf24l01 + need help! on: April 18, 2014, 09:12:17 pm
Your sending sketch doesn't receive any radio messages so it is not necessary to start and stop listening.

Your serial port handling code looks wrong. I haven't look at the message format you're trying to use but it looks as if you expect to receive multiple bytes from the serial port and that there will always be a complete message available. That isn't right - the message will come in slowly one byte at a time and if you want to process a complete message you will have to buffer the bytes as they arrive and work out when you have received a complete message.

On the receiving side you only process the first byte in the payload although there may be up to 32 bytes of useful data there.

For the purpose of testing the radio part, I suggest you disable all the serial port handling and just send a fixed hardcoded message and confirm it is received OK. Then you can check how fast and how reliable that is before you design the rest of your solution around it. Depending how fast you receive input on the serial port, you could easily find that the RF24 can't keep up when it is transmitting a message per byte.

The code to work out what number you have received is very repetitive and you could avoid the repetition by converting the character to a number and doing a range check on it.

Code:
if(isdigit(data[0])
{
  byte value = data[0] - '0';
  if(value == 0)
  {
    resetLEDs();
  }
  else
  {
    digitalWrite(pins[value-1], HIGH);
  }
}
else
{
  // unexpected character ignored
}

If I were you I would connect the receiver to a PC and use the serial port to tell you what it is doing. (Even if there won't be a PC available in the final system, use one for testing.) In that case you must avoid using digital pin 1 in your sketch since the hardware serial port uses it.
37  Using Arduino / Programming Questions / Re: Reading and generating square waves at the same time. on: April 18, 2014, 08:50:47 pm
I'm not familiar with that FreqPeriodCounter library, so I don't know whether you're using it correctly. Is it actually producing an accurate and consistent measurement? Is the FreqPeriodCounter object designed to be used in an interrupt context? I'd expect it to need some care to deal with volatile data and disabling interrupts around access to them. If it doesn't do that correctly, you can end up with spurious behaviour. If you get garbage in, nothing else is going to work.

Since the loop() function looks pretty fast, you could probably just poll the input pin state and from the name I guess that the poll() method was designed to do that. That's a hint it might not be designed to be used in an interrupt context.

There is no need to make period volatile since it is never accessed in an interrupt context.

There's a minor bug in your output timing code which could cause the output to slip slightly - I don't think this is causing your problem but I suggest you correct it anyway by changing line 32 to:

Code:
   previoustime += interval;
38  Using Arduino / Project Guidance / Re: Vision System Program Architecture - Fio V3 on: April 18, 2014, 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.
39  Using Arduino / Project Guidance / Re: Log FuelFlow -Reading 4 frequency inputs (digital on/off) and logging to SD card on: April 18, 2014, 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
}
40  Using Arduino / Project Guidance / Re: average noise level on: April 18, 2014, 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.
41  Using Arduino / Project Guidance / Re: Water Gun Race - Is it doable? on: April 18, 2014, 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.
42  Using Arduino / Project Guidance / Re: Vision System Program Architecture - Fio V3 on: April 18, 2014, 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.
43  Using Arduino / Project Guidance / Re: How can i take the best sensor values ? on: April 18, 2014, 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.
44  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.
45  Using Arduino / Programming Questions / Re: Boat autopilot - PID not centralizing rudder. on: April 17, 2014, 05:53:06 pm
 smiley-razz
Pages: 1 2 [3] 4 5 ... 748