Show Posts
Pages: 1 ... 87 88 [89] 90 91 ... 93
1321  Using Arduino / Project Guidance / Re: Interrupts during Serial output on: September 18, 2011, 03:29:46 pm
Another idea, on a different track.  I wouldn't have to write any code.  I wouldn't even need a controller!
On either end.  Could just hook 2 XBees to 2 amps, Mic, Speaker to hear it.
http://www.digi.com/support/kbase/kbaseresultdetl.jsp?kb=180

But it's only 1khz.

Of course this is not what I'm trying to achieve, but how Cool!
1322  Using Arduino / Project Guidance / Re: Max speed XBee on: September 18, 2011, 09:12:09 am
The distance is variable.  I have the 60mw model.  I'd like it to go full speed at 50m.  Slower at 1/4 mile in the woods.  Already this is working if I choose the appropriate delay in advance.  I want it to figure it out by itself as the conditions change.  Each byte delay should be different depending on if the XBee buffer is near full.  Not a constant delay between characters. 

In other words, I want to pause then the buffer is full.  Using CTS pin?

I didn't say I was storing 2K of data.  I'm sending audio data in real time as it's being sampled.  But only sometimes in blocks of 2K or 4K.  Should be able to send 8K if I can keep up.  It works great at 1/2 the speed.  This means sampling at 4khz.  I'd like 8khz.  This full speed works at a close range only.  So I've got everything I need already working.  Except I don't want to decide in advance which configuration to use.  How do I know when to slow down?

For example, I could send small 100 byte buffers at full speed without losing any data because of the Xbee transmit buffer.  If I can't keep up because the distance is too great, send the next one at 1/2 speed by averaging each pair of bytes.  Maybe 1/4 speed instead.  All I need is to be able to read CTS from XBee.  How do I wire this?  Is it already connected to Reset?  I have the Sparkfun shield.
1323  Using Arduino / Project Guidance / Re: Interrupts during Serial output on: September 18, 2011, 08:35:47 am
According to what I've read, you have to disable interrupts during serial transmission.  I assumed this is because you don't want it to be interrupted in the middle of a string of 8 bits?  Maybe this is wrong?  Is it as simple as you say?  Just send it in loop without turning off the interrupts to service the Mic?  That makes sense since the Serial.write call only takes a few uSecs anyway.  You wouldn't be interrupting the UART itself.  It is unlikely the write call would be interrupted if it's being called when the 1 byte buffer is empty.

If I do have to disable interrupts, it wouldn't delay the Mic sample much, only a few uSecs, not milliseconds.  The key is to avoid waiting for the 1 byte buffer.  Maybe interrupting this wait is bad?  Probably not.

I've realized the transmit buffer before the UART is only 1 byte.  But in the XBee it is 100?

The code will slow down on it's own waiting if the 1 byte buffer is full.  But I have to monitor CTS to avoid filling the bigger one.
1324  Using Arduino / Project Guidance / Re: Interrupts during Serial output on: September 18, 2011, 02:55:50 am
Sure, Circular/ring buffer.  I understand that part.  But if I send it to the serial port in loop, I have to disable interrupts for each byte sent.  Otherwise the ISR will interrupt the serial routine.  If I send more than one byte, the interrupts will be disabled for too long and I'll miss a Mic sample.  So I have to send one byte at a time then check for (enable) interrupts to sample the Mic.  If that's the deal, why not just send 1 byte at a time within the ISR?  My first experiment will be simple, the byte I just got.  Then add the ring buffer.

Can I send 1 byte from within the Mic sampling ISR?  There is no delay, assuming the buffer is empty.
1325  Using Arduino / Project Guidance / Max speed XBee on: September 18, 2011, 02:45:02 am
Let's say I wanted to send 2K of data as fast as possible from the Xbee on Uno to PC in transparent mode.  I've got it working using a short delay between each byte at 115Kbaud.  I arrived at this thru trial and error.  I'm getting 10.8KB/sec.  All the data goes without any errors or lost bytes.  Until you put some distance between them.  Now my delay is too short because of a few retries.  I'm trying to send a byte before the last one was sent. 

Can I use the hardware CTS pin from XBee to fix this?  My plan is to wait when the CTS line from XBee says it's full, until it's ready.

I tried increasing my delay between every byte, even the ones without retries, but then I only get 1/2 the speed.
1326  Using Arduino / Project Guidance / Interrupts during Serial output on: September 17, 2011, 05:25:56 pm
Thinking out loud here.  Please help!

I wrote a routine to sample the Mic at 8khz with interrupts in CTC mode it works! As you know the available RAM is only 2K. What to do with all this data?  I could write it to Openlog, USB, or Xbee.  All of these are Serial.  115kbaud is fast enough.  But whenever I write a character or buffer I have to turn off Interrupts first.  If I send more than a character at a time without servicing the Mic interrupt I will miss sampling the Mic on time.  These 2 speed, in and out, are about the same so I can't even send 2 characters in the time between Mic samples.  How do I send data serially without waiting for the buffer to finish sending?  During this time interrupts are disabled.

After more research I see that I can send ONE character without waiting, assuming the single character output buffer is always empty.  There will be retries with XBee so this might not always be true.  Or 2 characters and only need to wait for the 1st to send.  This does not help much for a buffer of size 100.  I still have to wait to send 99.

Let's keep it simple:
Can I send 1 byte each time from within the Mic sampling ISR using Serial.write? 

In this case can I leave Interrupts enabled since I know it won't be called twice?  Does Serial.write or Serial.print disable interrupts?  If so I'll just re-enable them.  I guess I have to do this anyway since I'm in an ISR.  I guess my real question is can I call Serial.write from within an ISR?  Anything special I need to do first?

Let's assume that'll work.  Please correct me if I'm wrong.  I should test it.  Now I'm going to get more complicated.  Let's say I want to modify the data in a buffer before sending it serially.  Can I use a small circular buffer for this?  Instead of sending each byte as it's received from the Mic directly, I can store it in the buffer in the ISR, then send the next single byte from the other side of the circle, all within the ISR.  1 byte in, 1 byte out.  Who says I have to send the byte I just got?  Noone right?

Sounds good?
1327  Using Arduino / Networking, Protocols, and Devices / XBee ACK failure count utility on: September 16, 2011, 12:40:53 pm
I've learned a few things about the XBee Pro type 1 today.  I wrote a utility to aid in range testing and reliability measurements.  I've noticed that the signal strength goes to the lowest level as you walk away long before the data stops coming reliably.  S/N ratio is a much more important measurement than just RSSI.  It's easier to display or record ACK failure count change per minute.  This is a more useful number because it measures what you want.  The data flow! 

The first thing you should do is measure the energy level in each channel at the location where the majority of your equipment is.  This is caused by interference from other digital circuits.  Most people will use the XBee Explorer hooked to their PC.  If you're collecting data than the energy measured here is by far the most important of the 2 locations.  Of the 12 Channels I've found 1-2 are usually very noisy.  1-2 are quiet.  Pick one of these!  It's easy using my Sketch.

I've tested a few antenna designs.  Wanted to find something simple and small to go with the wire antenna on the XBee.  Did some testing with the bottom end of a Bud can.  It's roughly parabolic shaped like a DTV dish.  In theory this should work at the proper distance from the element.  Maybe, but in practice, in the woods, it is very hard to adjust the distance and aim.  It worked better without the can.  Until...

One time by mistake I turned it around the wrong way so the convex side was facing the antenna.  In theory this should not work, but in practice it does!  Remember there are many wet trees, bushes, rocks, terrain, reflectors all around me deep in the woods.  What the convex side is doing is spreading out all the energy that would have been wasted going the wrong direction, but at least now in the right 180 deg half, towards the target.  Some of these reflected waves find their way to the receiver.  No more aiming!  Without the can, you have to aim the wire antenna in a horizontal plane.  Not left and right, but up and down.  There are many lobes with the strongest being not where you might expect.  With the convex can, this problem goes away!  Try it?

The results would be different in space, or even in the desert.

My conclusion after testing in many locations and with different variables:
It does NOT increase the range, assuming you aim the stock wire properly.
But it makes the aiming requirement of a simple wire go away!
You don't even need a signal or Sketch running to test the remote setup anymore.
1328  Using Arduino / Project Guidance / Re: Very Sensitive microphone/sensor for 'stethoscope' ? on: September 14, 2011, 12:55:24 pm
You can get / I've got free samples:
http://www.datasheetcatalog.org/datasheet/analogdevices/SSM2166S.pdf
The socket is $3.

With this:
http://www.doc-diy.net/photo/sound_trigger/
I can literally detect a pin dropping.
I've modified the circuit a little.
1329  Using Arduino / Project Guidance / Re: Drivers for USB devices on: September 14, 2011, 07:21:24 am
Hey I'm going to do exactly that!  (your signature)  Using the PTP library with tiny thumbnails at least.
Wait... Did you just call me a fool?  smiley-wink
1330  Using Arduino / Project Guidance / Re: Making a wireless USB connection. on: September 14, 2011, 06:49:27 am
Cost.  Too valuable to leave in the woods overnight.  For him perfect!
1331  Using Arduino / Project Guidance / Re: Making a wireless USB connection. on: September 13, 2011, 03:40:38 pm
Cool code!  I agree.  There's 2 different projects going on.  I've taken over the thread since the owner wasn't available...  smiley-wink
1332  Using Arduino / Project Guidance / Re: Making a wireless USB connection. on: September 13, 2011, 12:09:02 pm
I don't understand.  Would it be compatible with Xbee and the EOS utility software running on my PC to communicate to my Canon DSLR as if it were connected via USB cable wirelessly?
1333  Using Arduino / Project Guidance / Re: Making a wireless USB connection. on: September 13, 2011, 08:12:53 am
Tcp over com seems to be going the other way, TCP/IP over USB.  tcp-com requires a PC on both ends?  A router is cheaper.
1334  Using Arduino / Project Guidance / Re: Making a wireless USB connection. on: September 12, 2011, 09:44:04 pm
Googled:
tcp.com usb

Didn't see anything relevant?
1335  Using Arduino / Project Guidance / Re: Making a wireless USB connection. on: September 11, 2011, 11:29:53 pm
How much further?  This works with a wifi router:
http://www.siig.com/it-products/device-server/usb-over-ip/usb-over-ip-1-port.html
Pages: 1 ... 87 88 [89] 90 91 ... 93