Show Posts
Pages: 1 ... 42 43 [44] 45 46 ... 48
646  Using Arduino / Sensors / Re: 360 degree wind direction sensor on: January 11, 2012, 12:07:28 am
For a bit more money, the inspeed directional vane looks really tasty. A sealed hall effect sensor, no deadband, a 5VDC input, and a 0.25-4.75V output with 12 bits of resolution. I'd oversample the sucker, decimate, and enjoy that 0.25 degree resolution... see the data sheet at
647  Using Arduino / Sensors / Re: 360 degree wind direction sensor on: January 10, 2012, 04:56:36 pm
Couldn't you use the Modern Device approach to put a couple of RTDs on a compass rose with tunnels to determine the vector and the speed of the wind? You'd need a custom PCB...
648  Using Arduino / Sensors / Re: Basic ADC/Analog read question on: January 10, 2012, 04:41:58 pm
You can look up the bandgap reference at Wikipedia: It's a great way to determine the Vcc since the Bandgap voltage is stable while Vcc may not be. Depending on how quickly you want to sample data, determining the bandgap voltage to Vcc difference may be a great way to improve the accuracy of the analog reads.  However, consider that the ADC uses a multiplexer and a sample and hold system to make a analog read (see the Atmel datasheet for the 328 for a diagram).

So, first you have to select a single channel to sample, then you have to make the reading, settle for stable results, etc. At the very least, you'll need 13 ADC clock cycles to sample each analog channel. If you change the reference voltage, the ADC needs 25 clock cycles to make the change, followed by throwing out the first sample (per Atmel it's allegedly garbage). Perhaps that is what retrolefty is accomplishing with the 50 millisecond delay in his very cool and clever code. Thus, if you have a fast changing signal (i.e. noise on the Vcc line), you may or may not capture it properly with the bandgap approach. Peaks on one signal or the other may or may not show but ideally you'd have both signals sampled at the same time to cancel out coincident noise.

If you're using a standard Atmel on an Arduino board (i.e. at 16Mhz clock speed), your highest sampling rate (if the ADC is free running) for 10-bit resolution is about 12,500 samples per second. Using analogread commands results in about a 3x slower sampling rate due to Arduino IDE overhead. Retrolefty's code is very fast because he is bypassing the Arduino analogread command and is addressing the ADC directly. I also admire how it detects what model of processor it is running on to adjust the reference voltage. To my (currently tired) eyes his code makes the most sense if you're running an Arduino off of batteries and want to see where the input voltage is to send an alert to the user (think remote weather station, for example).

I tried out a couple of external ADCs but found most of them terribly frustrating. For one, it is very hard for me to troubleshoot a SPI device that may or may not be configured properly.

As a result, I chose to use a Arduino/Atmel ADC with an external AREF voltage reference (being able to reprogram the thing and get feedback re: results has been a godsend). A small linear regulator and a 1uF capacitor provide a very smooth voltage power supply regardless of whether you are powering the board via the USB bus, an external wall-wart, or the ICSP header. That makes calibration a lot easier - i.e. regardless of power source, your results should be very stable. So even if you choose to use an ADC, consider creating a stable voltage at 3.3V, for example, to feed the ADC voltage reference and hence reduce the potential for noise.

BTW, the folks at the open energy monitor project also have a nifty implementation of a high pass filter in their basic monitor implementation / Arduino source code suggested by Atmel to remove a 2.5VDC offset that also attacks noise problems in AC signals. Last but not least, consider looking up the Atmel paper re: decimation/oversampling. If you have the luxury of a slow-moving signal, even a 10-bit ADC can produce 16-bit results under the right circumstances.
649  Using Arduino / Sensors / Re: Voltage Reference OK on AREF? on: January 10, 2012, 12:43:29 pm
Thank you, John. What size resistor have you used? I cannot find a recommendation in the datasheet, but for all I know there is a specific application note that I may have missed.

In the past, I have used a LD39015M125R voltage regulator providing 1.25V to AREF, a 1uF cap, and the two BAV99s protecting the inputs - and it worked. However, as I understand it a voltage reference is a different animal and hence may not survive what this regulator apparently has. Maybe I should just design around a voltage that the LD39015 series can provide?

For example, the LD39015M25R puts out 2.5V and I could just set up a voltage divider to take care of the rest...
650  Using Arduino / Sensors / Re: HCZ-J3A Humidity Sensor on: January 10, 2012, 06:51:59 am
And for that everyone who has ever used it thanks you!  smiley

Figuring out how to communicate with that proprietary protocol cannot have been easy, nor writing a library, posting instructions, etc. Thanks again!
651  Using Arduino / Sensors / Voltage Reference OK on AREF? on: January 09, 2012, 10:34:09 pm
In the interest of maintaining a good supply voltage on the AREF pin, I am considering a voltage reference, the MAX6107. This little SOT23 + a 1uF capacitor is allegedly all I need to maintain a stable 4.5V. For those who have been through this before me, I wonder if I have this right...

On page 343 of the 328P datasheet (, the AREF current requirement is listed as about 130uA @ 4.5V. The Maxim 6107 ( is allegedly good at putting out up to 5ma if I am reading that datasheet correctly. So, assuming we're driving nothing more than the 328P and two BAV99s off of the AREF source, the Max6107 should be OK, the AREF=4.5V, etc.

Or am I missing something?
652  Using Arduino / Networking, Protocols, and Devices / Re: Differences between RS485 chips? on: January 09, 2012, 10:17:53 pm
Thanks again.

I went for the rs485 connection simply to ensure signal integrity. Plus, it's harder to connect rx to rx with a set of RS485 chips in the middle.

Now on to the remaining questions before I bake out another PCB...
653  Using Arduino / General Electronics / Re: Questions regarding power capacity of strip headers on: January 09, 2012, 11:02:24 am
Thank you, Mike!

I also wanted to thank you for your suggestions regarding the protection of the Analog input on your site.
654  Using Arduino / Networking, Protocols, and Devices / Re: Differences between RS485 chips? on: January 08, 2012, 09:27:09 am
Thanks Graynomad, I appreciate your help.

In your opinion, would a project with two arduino boards communicsting serially benefit from having an rs485 connection, even if the total line distance is less than 3m/10ft? Perhaps the better question is, would rs485 be overkill? I'm currently planning on using rs485 simply because it is so noise resistant.

It appears that just about any of the rs485 chips I have looked at can handle 250kbaud and up. I guess I'll also look for high esd protection as a nice to have - the price difference with Exar chips is something on the order of 3 cents each.
655  Using Arduino / Networking, Protocols, and Devices / Differences between RS485 chips? on: January 07, 2012, 02:15:34 pm
There seem to be many such chips on the market, whether they're from MAXIM, TI, ST, Linear, etc. All of them seem to have similar pinouts for the standard 1/1, DIP8/SOIC8 configuration. So what would make one select one model over the other? I looked at the ST485B, Linear LTC485, and Ti SN65176B, and the Dallas/Maxim MAX485, all sold at prices that can be dollars apart, yet the functionality appears identical...
656  Using Arduino / General Electronics / Questions regarding power capacity of strip headers on: January 07, 2012, 02:05:37 pm
I am in the midst of trying to figure out how to best switch the power input between getting power from the serial connection (i.e. bootloader / programing) vs. getting it from external power (5VDC). I have seen other implementations such as the RBBB rely on nothing more than strip headers to accomplish this, i.e. a 3-in 0.1" strip header with a shunt. However, what are the power limits of such headers and shunts? If a maximum current of 1A were to pass through there @ 5VDC, would it be safe?

When looking through datasheets on slide switches and other alternatives, should I be focusing on the ampere rating or would VA be more applicable since my voltage is so low? I'm inclined to limit myself via amps because I'm cautious...
657  Using Arduino / Sensors / Re: HCZ-J3A Humidity Sensor on: January 07, 2012, 09:23:32 am
The more I look at this thing, the more I wonder about where it is implemented by itself and why.

Feeding a stable 1kHz AC signal into anything would likely require a dedicated chip to do the work. Then something needs to measure the impedance and output a useful signal (whether its pulses or whatnot). Oh, and you also need a temperature sensor to compensate the output... My guess is that you're holding the sensor portion of what is inside the DHT sensor... they add the other required hardware and have a small processor in there to do all the work for you and deliver a nice data stream on request.

I use the DHT22s and for $12 from iteadstudio or $10 from Sparkfun they work great. Plus, compared to the analog-output humidity stuff that Honeywell sells, they are very inexpensive and much more capable. Better yet, the use of a digital signal makes DHTs far more easily implemented in remote sensor nodes than systems using analog signals.
658  Using Arduino / Sensors / Re: HCZ-J3A Humidity Sensor on: January 05, 2012, 10:14:25 am

I just re-read the datasheet and noticed that they have a 1V maximum input voltage!!!! You will need to have a bigger resistor in series, at least 5K to keep the voltages down to safe levels for the sensor. Even a 555 circuit may also expose the thing to too much voltage unless you use a series resistor. I apoogize for overlooking that tidbit in the datasheet.

One option is creating a separate 0.5V voltage supply for the AREF pin to improve your resolution across this resistor. Also in the datasheet is a reference towards driving the thing with a 1kHz AC signal. Since I don't understand the underlying technology, I have no idea why the sensor requires this sort of excitation. You could consider running current back and forth through the thing to emulate a sine wave signal with a square signal instead. By keeping the DC voltage down to 0.5V, you should be safe.... at least I hope!     

This sensor is a lot more difficult to implement than I expected. Perhaps that's what is driving the higher costs of competing models... i.e. they have temperature sensors, conditioning circuits, etc. on board that do all this work for you. How valuable is your time? I'm starting to wonder if a DHT-11 isn't a better bet.
659  Using Arduino / Sensors / Re: HCZ-J3A Humidity Sensor on: January 04, 2012, 07:30:56 pm
Looking over the data sheet, it seems to me that you should be using a smaller divider resistor or a different kind of circuit. A 1k resistor is probably worth trying  since the lowest resistance of the sensor is around 1k. A 2k resistance results in a drain of no more than 5mA, should be OK on the Arduino.

However, a rc circuit with a frequency counter might work better, ie detect how the frequency of the circuit changes as r changes. Use the resistor in a classic 555 astable multivibrator circuit (see, then count the pulses/s via one of the interrupt pins with an ISR. Every second, review the count, calculate the humidity.  Maybe you can even eliminate the 555 from the equation with some equivalent software magic on the Arduino.

I.e. charge a serie RC circuit via a pin for longer than you know it needs to. Then measure the elapsed time until the voltage across the resistor drops to 1/3Vcc, recharge, rinse and repeat. You may even be able to use the same pin to do both. The size of the capacitor will then determine the frequency with which you can update the humidity. In other words, you need a fairly small capacitor in order to make the circuit work quickly. A common 0.1uF cap might be a good start, then experiment. If you have any 1000pF/1nF film caps lying around, that might be an even better bet since you'd be able to sample the sensor several times per second.

If you drop deep down into the  ADC functions (i.e. change the ADC pre-scaler, use ADHL instead of analogread, etc.), you can get some very fast reads at a loss of resolution (i.e. quasi-8bit) that may be acceptable. Then run a couple of loops in a row, and average or (better yet) decimate to improve your results if necessary.  Coming up with a curve-fit for the data (as a function of resistance and temperature) will be interesting.
660  Using Arduino / Networking, Protocols, and Devices / Re: Faster Serial on: January 03, 2012, 12:11:56 pm
Skyjumper, I agree that careful programming could get me closer to doing it all on one CPU, but I am not a programmer by heart - this is just a hobby. And the 328P is pretty inexpensive and by dedicating a chip, I can be pretty sure I will not miss any transients, no matter how small. Another consideration was the number of interrupts the chips have to handle. One interrupt for the DS3231 is to signal that another second has elapsed, one for the NRF for communication, etc. I was afraid of getting into trouble with all the ISRs... so two chips makes it easier. The second serial port on the 1284p uses two of the available interrupt pins, IIRC, but the second hardware serial is a bigger benefit IMO.

The CAN bus is certainly a great tool... and robust. But I'd have to learn a lot more and breadboard the heck out of that before I'd attempt to use it. Plus, using SPI without standing on the shoulders of giants (i.e. SDFat, for example) is likely outside my realm of possibilities.

I was afraid that modifying the pins file would not be enough. But I really appreciate your and maniacbugs efforts to get the 1284p the support it needs to be used by the Arduino masses. To date, I have relied successfully on the 022 Brewtroller 'fork' of the Arduino IDE, which works great. I think I will stick to that until I get this project finished... if it works and all that.

Maniacbug, I will attempt to try out your add-ons to the IDE on a different CPU and see if it all works... thanks again for your efforts too!
Pages: 1 ... 42 43 [44] 45 46 ... 48