Show Posts
Pages: 1 ... 441 442 [443] 444 445 ... 585
6631  Using Arduino / Networking, Protocols, and Devices / Re: Arduino as SPI slave on: May 07, 2011, 05:34:24 am
You can't do that because the SS signal is an input on your slave Arduino, it needs to be held low for the SPI hardware to work. The quickest way to do this (just to get things working) is to plug a wire (aka flying wire/lead) in with one end in a GND hole (one the Arduino headers) and the other end into the SS input, D10 on the Duemilanove and D53 on Mega. (not sure what you have).

6632  Using Arduino / Networking, Protocols, and Devices / Re: Arduino as SPI slave on: May 07, 2011, 05:03:50 am
I think you're good to go. The code assumes two-way comms which you don't need so you can drop this line

 // have to send on master in, *slave out*
  pinMode(MISO, OUTPUT);

Also on the slave you have to pull the SS pin low (use a flying wire for starters) or the SPI won't receive.

6633  Using Arduino / Networking, Protocols, and Devices / Re: Arduino as SPI slave on: May 07, 2011, 04:16:19 am
I think I get it now, you need your AVR to receive SPI at 2500bps from the UAV's AVR?

As you are receiving the speed is not a problem, the hardware will do it for you.

Normally there is a problem with AVRs as slaves because there is no buffering for the input data, by the time you get an interrupt to tell you that there's data to be read half the next byte has been clocked in. This is solved by having the master add a small delay after each (especially the first) byte.

However at 2500bps you might get away with it, you have 400uS from the end of a byte to the first bit of the next byte (unless there's some weird "feature" of the hardware that gets in the way) . That should be enough I would think to use interrupts to get the data.

Have you tried Nick's slave code? Is it not working?

6634  Using Arduino / Sensors / Re: Sensing tank fullness on: May 07, 2011, 03:35:59 am
If you think about a sonography
True, but I doubt your average Pulolo sensor will be up to the job. And glass is much denser than skin, I still think it would be opaque (but maybe not).

Boats tend to heave
As do many things when on boats smiley

In the case of a boat I reckon a pressure sensor in an outlet tube (assuming fed from a bottom outlet) would be the best way. There must be a method to isolate the sensors with an air gap. The OP's original idea was pretty good I thought, especially if there's an existing outlet so the tank doesn't have to be drilled.

6635  Using Arduino / Project Guidance / Re: Interfacing with an RTC 3234 on: May 07, 2011, 01:42:18 am
Where did you get the Arduino pins numbers from?

On 2009 it's

CLK -> 13
MISO -> 12
MOSI -> 11

On 2560

CLK -> 52
MISO -> 50
MOSI -> 51

Although in both cases you can get the signals from the ISP header as well.
6636  Using Arduino / General Electronics / Re: LED clock display on: May 06, 2011, 10:03:22 pm
Thanks John,

I had seen those models but after a mind-numbing hour or so looking at spec sheets I missed the fact that the three extra DPs had separate pins. I can use them and blank out the "degrees" LED.

I'll revisit them, they are smaller than i'd like though.

There are a stack of displays on the Mouser site and some that look good, but when you try to find the part on the manufacturer's site they don't exist, for example the MSQCxxxx is listed as an Everlight product, search for that on the Everlight site and you get nothing. Not very confidence boosting. The product is actually from Fairchild but I think Everlight has bought the rights to the LEDs from them, maybe they just haven't updated their web site or maybe they intend to retire many of the products.

Now realistically I will probably never use more than about 10 displays so I could just buy them now, but it goes against the grain to use an orphaned or hard to find product with no second source.

Who would have thought such a simple thing would be so hard?

Maybe the best thing to do is use discrete digits and a few LEDs.

6637  Using Arduino / Networking, Protocols, and Devices / Re: Arduino as SPI slave on: May 06, 2011, 09:45:32 pm
2500Hz is indeed very slow and you'd have to wonder why that is.

Certainly if you've been using shiftOut() it won't be that slow and I doubt you could get it to run that slow. You'll have to bit bang the data.

I like the idea of an on-board serial EEPROM (or flash for that matter) chip, the only thing is that the data structure has lat and long so by using telemetry you can find the plane (is that a requirement?).

6638  Using Arduino / Programming Questions / Re: Need help with an "IF" statement ... on: May 06, 2011, 09:36:36 pm
A line like

if((dht_IN_Temp >= Temp_IN_Value + Temp_IN_Value_Threshold && dht_IN_Temp - dht_EXT_Temp >= 5) || dht_IN_Hum - dht_EXT_Hum <= -15 || millis() - ActiveAerationPreviousStateChangeMillis >= ActiveAerationOffDuration){

Is so confusing I don't think there's a chance it's doing the right thing. And if it is it's totally unmaintainable.

I'd at least try to put the tests on separate lines

if( (dht_IN_Temp >= (Temp_IN_Value + Temp_IN_Value_Threshold) &&
(dht_IN_Temp - dht_EXT_Temp >= 5) ||
(dht_IN_Hum - dht_EXT_Hum <= -15) ||
(millis() - ActiveAerationPreviousStateChangeMillis >= ActiveAerationOffDuration)

But it's not clear if is should be

a && (b || c || d)


(a && b || c) || d
or whatever. Now I'm sure you could look into the operator precedence but you shouldn't rely on that anyway. I'd be included to split the calculations from the tests

int a = Temp_IN_Value + Temp_IN_Value_Threshold;
int diff_temp = dht_IN_Temp - dht_EXT_Temp ;
int diff_hum = dht_IN_Hum - dht_EXT_Hum ;
int d = millis() - ActiveAerationPreviousStateChangeMillis ;

   if(dht_IN_Temp >= a && diff_temp >= 5 || diff_hum <= -15 || d >= ActiveAerationOffDuration) {

This needs better variable names and still needs ()s to force the order of tests but I think it's a lot clearer.

6639  Using Arduino / General Electronics / Re: Powering from AREF issue - (DS18B20) on: May 06, 2011, 09:01:02 pm
I would think that using the internal AREF as a power supply is dodgy practice anyway.

6640  Using Arduino / Sensors / Re: Sensing tank fullness on: May 06, 2011, 08:48:11 pm
You wouldn't get a secondary reflection would you, I would think glass is opaque to ultrasonic?

Also, as I understand those sensors only provide for a single response.

6641  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Slave to Arduino Master SPI on: May 06, 2011, 07:59:45 pm
i presume to select other slaves on your BUS you can substitute the any DI pin as an SS pin to select a slave?

6642  Using Arduino / General Electronics / Re: LED clock display on: May 06, 2011, 10:33:38 am
That's probably why they are so cheap smiley

I can't play with cutting tracks because this could be a product, and also I need to be able to alternate between time and numbers under program control.

So this display is useless. I thought I'd found a better one at Mouser but just realized it's common anode smiley-sad

I can't believe these are so hard to find.

6643  Using Arduino / General Electronics / Re: LED clock display on: May 06, 2011, 03:43:39 am
I haven't got one but the photos show 12 pins so I'd say yes.

I've emailed the distributor (no answer yet), but as it stands this is totally useless, how could they make such a thing and have it on the market?

6644  Using Arduino / General Electronics / LED clock display on: May 06, 2011, 02:11:04 am
I'm thinking of using this LED clock display (data sheet attached) to display either numeric data or the time.

But from what I can see the DP2 and colon LEDs are wired in parallel. This would mean that they can't be individually controlled which in turn makes the display totally useless for either.

Have I missed something?


6645  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Slave to Arduino Master SPI on: May 05, 2011, 10:58:42 am
That's exactly the method I suggested in a thread a couple of days ago. The only hassle is that you have to "reconstruct" the data because you get 8 bytes in with all the "0" bits in one byte,  all the "1" bits in the next byte etc. But depending on the application that may not be an issue.

You could to up to 8 devices this way (or more if you use a second/third/etc port).

I haven't done the maths though, because you would have to bit bang the SPI it may still be faster to daisy chain and use the SPI hardware, or use the standard technique with N select lines.

Did you measure any speed advantage?
Pages: 1 ... 441 442 [443] 444 445 ... 585