Show Posts
Pages: 1 ... 383 384 [385] 386 387 ... 695
5761  Using Arduino / Sensors / Re: Stabilize analogRead? on: October 11, 2012, 01:43:24 pm
Yes, almost certainly you didn't common the grounds - you can't measure anything if there isn't a reference point.
5762  Using Arduino / Sensors / Re: Capacative Pressure Sensor on: October 11, 2012, 01:34:47 pm
Yes, sounds pretty plausible - you could use a capacitive bridge using the sensor and a fixed capacitor of roughly equal value.

join the two capacitors and connect to an analog input.  The other lead of each cap goes to a digital pin via a 150ohm resistor, and you feed the digital pins in anti-phase.  To centre the analog pin connect it to both GND and 5V via two 10M ohm resistors.

The amplitude and phase of the signal on the analog pin depends on the relative capacitance values.  Code something like this might do the job (well I haven't tested this, so a pinch of salt advised):
Code:
void  loop ()
{
  digitalWrite (dpin1, LOW) ;
  digitalWrite (dpin2, HIGH) ;
  int difference = analogRead (apin) ;
  digitalWrite (dpin2, LOW) ;
  digitalWrite (dpin1, HIGH) ;
  difference -= analogRead (apin) ;
  if (difference > threshold)
    digitalWrite (outpin, HIGH) ;
  else
    digitalWrite (outpin, LOW) ;
}
5763  Using Arduino / General Electronics / Re: 16 Channels of 15V Analog Inputs... Any Suggestions? on: October 11, 2012, 01:19:17 pm
That is why they have a thing called a voltage divider.

That's possible of course, but precision is potentially going to take a big hit even before the resolution of the ADC is factored in.  From the perspective of the signal's information content a voltage divider going from 5 to 15 V down to 0 to 5 V means there will be roughly three times less usable information detectable in the output signal.  For some applications that's not a problem, for others it will be.  Instead, I would check to see if there is an affordable ADC chip/module that can handle the orignal input voltage and output serial communication of some sort at 5 VDC.  

I'm afraid you are wrong in nearly every detail in that paragraph!

Firstly information is a logarithmic measure so a loss of a factor of 3 in precision is a loss of 1.6 bits of information.  Given a good ADC can give 20 bits, that would be only a loss of 8% information (18.4 bits / 20 bits).

Secondly a voltage divider doesn't throw away information like that - you need to know the signal/noise ratio and bandwidth of the source and the actual resistance values and their temperature, then you can calculate degradation in signal/noise ratio.  If the source is already noisy the potential divider might have almost no effect.  If the source is clean and low-impedance then a high-resistance voltage divider might be injecting massive amounts of noise compared to the source.

Resistors generate voltage noise proportional to temperature and to the square-root of the resistance value and to the square-root of bandwidth.

Thirdly the ADC might be introducing quantisation noise that's far greater than the signal noise - in which case everything else would be academic.  If you are only using a 8 / 10 / 12 bit ADC its likely to be the dominant source of error.
5764  Using Arduino / General Electronics / Re: 16 Channels of 15V Analog Inputs... Any Suggestions? on: October 11, 2012, 01:05:04 pm
AS to voltage dividers has anyone considered that an op-amp can have less than unity gain, that they make great attenuators as well and handle +/- 15 Vin as well? at ANY input impedance? 10 ohms to a T ohm are readily possible.

Bob



Non-inverting attenuation is easier as buffer followed by voltage divider.  Attentuating op-amp configuration is inverting so has finite input impedance.


5765  Using Arduino / Project Guidance / Re: Which boards to use for multy drop sensor network? on: October 11, 2012, 12:48:07 pm
First find out the cost of cabling required and compare that against the cost of some RF modules like Xbees - that might help decide which route to go down.

For wired comms the physical layer would need to be something like RS485 to get reliable 100m - differential signalling is reassuringly robust - that would suggest using CAT5 cable for cheapness (though its not rated for outdoors I believe).
5766  Using Arduino / Project Guidance / Re: How Do I Put Wireless Radio Transmitting Module, In Sleep Mode on: October 11, 2012, 12:42:19 pm
If you searched for the datasheet and read it you would have seen this:

Quote
* Device in deep sleep mode when Data pin is grounded
5767  Using Arduino / Project Guidance / Re: Square Wave manipulation on: October 11, 2012, 12:40:22 pm
Quote
Max rpm is 10500, and I want a signal that is precise within max 0.5 degree. Is that possible with the arduino? I have no intention in learning assembler for this project.

The math for this(?):
10500 rpm/60 secs = 175 rev/sec
1 sec / 175 rev / 360 degrees / 2 (to have a ½ degree) = 0.0000079 sec. to calculate, count time and set the output pin on the arduino.

That's 8us approx, which should be achievable.  Using interrupts would give you pretty good resolution (1us or so?), but just polling an input ought to be good enough (there will be some jitter from the timer0 interrupts, could be an issue).

You need to keep recalculating the delay as it is a function of the current RPM - there should be enough time between pulses as you have over 5ms.

Quote
Next when the micros resets, I can't have it to fire at the wrong time, is it possible to make it skip the one output when that happens?
So long as you use the correct test roll-over is invisible - you do something like:

Code:
volatile long trigger_timepoint ;
volatile long last_timepoint ;
volatile long current_period ;

void loop ()
{
  while (micros() - trigger_timepoint < 0)
  {} // wait till trigger time

  output_pulse () ;

  while (micros () - trigger_timepoint >= 0)
  {}  // wait till trigger changes
}

void  int_handler ()
{
  this_timepoint = micros () ;
  current_period = this_timepoint - last_timepoint ;
  // current_angle is fixed-point 16.16 representation of the fraction of whole-revolution.
  trigger_timepoint = this_timepoint + (current_angle * current_period) >> 16 ;
  last_timepoint = this_timepoint ;
}

The important point is to subtract one time from another and then look at the sign, don't directly compare them.

I've given a suggestion as to how an interrupt driven variable delay could work - attach the int_handler to the relevant pin, and the main loop polls for changes in the trigger time, waits for that time and sends a pulse.
5768  Using Arduino / Project Guidance / Re: Smart Helmet with arduino on: October 11, 2012, 12:16:36 pm
Also be aware that many solvents will _totally_ weaken crash helmets, so how you attach the sensors has to avoid using solvent-based glues.
5769  Using Arduino / Project Guidance / Re: VU Meter Using a 180 degree Servo on: October 11, 2012, 12:10:54 pm
Presumably a large VU meter then...  Sounds a reasonable implementation - find out how long the servo takes to respond to a seek and update at that sort of rate.  Because it'll be always active you'll need to make sure the power supply is up to the task.  I don't know what the lifetime of a servo is if it's constantly moving - might be an issue?

Another possible idea is using the head-positioning mechanism from an old dead disc drive and adapting it -
5770  Using Arduino / Project Guidance / Re: Arduino touch screen on: October 11, 2012, 11:55:45 am
Actually I've had a look at that library - it has fixed assigments for pins (which depend on whether Uno/Mega/Leonardo and whether the shield or the adapter board).   So it would be a little tricky - all the pin stuff is done via macros.  For two displays you can share all the pins except the CS (chip select) I think, so only the macros for that would need to be changed to take an argument selecting which display.  Probably.
5771  Using Arduino / Sensors / Re: Strain Gauge to INA125 Troubles on: October 10, 2012, 08:48:13 pm
Try switching the bridge connections to the + and - inputs round - then you output will increase with increasing load.

You probably might then need a balancing circuit to trim the zero reading to something around 0.4V or so (at low range of INA125's output, but not saturated).

If the circuit is sensitive to your hand it likely to be oscillating - you need a ground-plane for high-gain amp circuits like this and keep inputs shielded and away from outputs.
5772  Using Arduino / General Electronics / Re: My inductor isn't working on: October 10, 2012, 08:38:17 pm
Well its only rated at 7mA DC which is very small..  How much current do you want?
5773  Using Arduino / Project Guidance / Re: Help Displaying Temp On Two 7-Pin LEDs on: October 09, 2012, 08:43:16 pm
Code:
  void loop()
  {
    read();
   
    {
    if (temp >= 60 && temp < 70)
   
      if (temp == 60)
      {
        showLED6();
        showL0();
      }

See the problem?
5774  Using Arduino / General Electronics / Re: 16 Channels of 15V Analog Inputs... Any Suggestions? on: October 09, 2012, 08:39:53 pm
Is 10 bits (1024 steps) not enough? 12 bits places a lot more effort on you rpart to get everything just right.

IF 10 bits is enough than some of these:
https://www.sparkfun.com/products/8636

Along with your analog inputs should work.

You can also google 12 bit ADC SPI

That's not 15V compatible.

That's the big issue.   But we need more info about signal source before choosing an appropriate method of handling the signals - high impedance?  low impedance?  Definitely within the 0..15V range? 

Clearly an analog multiplexer good for 15V would be a start (the original CMOS 4000 series can do that I think).  But converting down to 5V needs either an active or passive attenuator circuit.  And up-converting the signals to drive the analog multiplexer might be needed.  I feel there is probably a modern 16way analog multiplexer that can handle 15V analog and use 5V digital - might be surface-mount though.
5775  Using Arduino / Project Guidance / Re: Help Displaying Temp On Two 7-Pin LEDs on: October 09, 2012, 08:29:21 pm
Post your code as it is now, I'm sceptical about the = / == thing smiley-wink

I'll leave you to the learning process - find some other 7-segment driver code and read it - and find out how it all works, it will be a very useful exercise.
Pages: 1 ... 383 384 [385] 386 387 ... 695