Show Posts
Pages: 1 2 [3] 4 5 ... 175
31  Using Arduino / General Electronics / Re: Ultrasonic sensor circuit design on: August 14, 2014, 09:10:18 am
You don't need R5/R6.  Have you tried to google "HC-SR04 schematic" ? Don't invent a wheel, here is correct design:
http://uglyduck.ath.cx/HC-SR04E/HC-SR04.svgz
32  Using Arduino / Sensors / Re: Reading an oxygen sensor on: August 14, 2014, 12:07:29 am
I'd vote for diagram 40, w/o rcv420, direct drive AinP with AinN grounded.
33  Using Arduino / General Electronics / Re: Arduino Due: Minimum reading of "20" on analog inputs on some PCBs on: August 12, 2014, 06:38:33 pm
Here a quote from STM32F103 data sheet:
Quote
Calibration
The ADC has an built-in self calibration mode. Calibration significantly reduces accuracy
errors due to internal capacitor bank variations. During calibration, an error-correction code
(digital word) is calculated for each capacitor, and during all subsequent conversions, the
error contribution of each capacitor is removed using this code.
Analog-to-digital converter (ADC)
Calibration is started by setting the CAL bit in the ADC_CR2 register. Once calibration is
over, the CAL bit is reset by hardware and normal conversion can be performed. It is
recommended to calibrate the ADC once at power-on. The calibration codes are stored in
the ADC_DR as soon as the calibration phase ends.
Note:
1 It is recommended to perform a calibration after each power-up.
2 Before starting a calibration the ADC must have been in power-off state (ADON bit = ‘0’) for
at least two ADC clock cycles.
Looks like Atmel has not implemented this nice feature in its uCPU. So, external circuitry, if its just 3 resistors would be necessary, and than some code to measure at start-up time and subtract this offset later on. Things may get complicated when gain and differential mode in use. 
34  Using Arduino / General Electronics / Re: Arduino Due: Minimum reading of "20" on analog inputs on some PCBs on: August 12, 2014, 11:47:53 am
Quote
The solution is to use either software or hardware calibration.
Yes, that what I thought, but I couldn't find any reference in the data sheet how to invoke a recalibration of the ADC.  Anyone knows?
For example, on Maple (STM32 cortex-3 , practically same uCPU as ARM SAM3X), you can run:
Code:
adc_enable(ADC1);
    adc_calibrate(ADC1);
35  Community / Exhibition / Gallery / 3D Ultrasonic Radar. on: August 10, 2014, 10:52:23 am


 And short description: http://coolarduino.wordpress.com/2014/08/10/virtual-touch-screen-3d-ultrasonic-radar/

Have a nice day.
36  Using Arduino / Programming Questions / Re: Measure Frequency/Mph of Piezo Vibration Sensor(Analog) on: August 05, 2014, 06:23:10 am
In response to edited reply #5:
Quote
The only problem is, if I'll be using 3 vibration sensor I'll need an external analog comparator, yes? Could you recommend one for me?
No, you need 3 arduinos. Comparator internally configured to ICP. What is the ICP , look in the data sheet of AtMega328.
I'm not advising on the part number and sourcing.  Post another topic.
With alll due respect, have you considered to build a project with LEGO, instead of arduino?
37  Using Arduino / Audio / Re: Correcting Waveform Centre on: August 04, 2014, 08:51:23 am
Scale your DDS around 128,  with positive +127 and negative -127. Than put a cap to eliminate DC offset, about 2.5V
38  Using Arduino / Project Guidance / Re: Measuring distance with RF on: August 04, 2014, 08:46:19 am
Quote
I just read about micros() having a 4microsecond resolution, that equates to 1.2km
Just don't use pulseIn, get timing from ICP - input capture of Timer1 running 16 MHZ, 62.5 nsec.
If you take DUE with 84MHz uCPU clock, you will get about 5 m resolution.
Averaging over 256 ping's would increase this value down to ~1 m or so.
May be slow for real time flying plane
39  Using Arduino / Programming Questions / Re: Measure Frequency/Mph of Piezo Vibration Sensor(Analog) on: August 04, 2014, 05:44:27 am
Quote
Sir, is it okay if I use a digital pin for my sensor?
Yes, if you build a circuitry to bias comparator inputs.
Quote
The code in the link you gave me only displays "FreqPeriod Library Test" even when I bend my sensor.
Bend? Do not, you can easily destroy sensor or your arduino.  Tip a pencil on a desk, where the sensor placed
40  Using Arduino / Programming Questions / Re: Measure Frequency/Mph of Piezo Vibration Sensor(Analog) on: August 04, 2014, 04:33:51 am
Start from here http://interface.khm.de/index.php/lab/experiments/frequency-measurement-library/
Can you get an osciloscope and post an image of the signals waveform?  So, comparator approach from the link may be sensitive down to a few mV. If piezo outputs less than that, you may need an amplifier.
41  Using Arduino / Project Guidance / Re: Trigger laser (or break a beam) without anything on the other side on: August 03, 2014, 04:39:25 pm
What kind of the trespassing object, size, reflectivity in optic & RF, magnetic property, 
42  Products / Arduino Due / Re: Converting SPI code from an UNO to the Due on: July 31, 2014, 11:22:36 am
Due attachInterrupt:
Quote
The Arduino Due board has powerful interrupt capabilities that allows you to attach an interrupt function on all available pins. You can directly specify the pin number in attachInterrupt().
http://arduino.cc/en/Reference/attachInterrupt
And,  try to change SPI.setClockDivider(smiley-cool; to SPI.setClockDivider(42);
Do you have a scope? W/o one debugging interface may be very tricky.
43  Products / Arduino Due / Re: Analog Comparitors on: July 31, 2014, 09:46:50 am
I think DUE's ADC has comparator mode,  look in the adc.h and adc.c
Code:
void adc_set_comparison_mode(Adc *p_adc, const uint8_t uc_mode);
uint32_t adc_get_comparison_mode(const Adc *p_adc);
void adc_set_comparison_window(Adc *p_adc, const uint16_t us_low_threshold,
                                                                        const uint16_t us_high_threshold);
void adc_set_comparison_channel(Adc *p_adc, const enum adc_channel_num_t channel);

Section 44.7.9 to set interrupt on comparator, bit 26 - COMPE.
                44.7.14 - setting EMR register.

Just an example, haven't use comparator yet, but here how you can wrap it up:
Code:
void adc_setup ()
{
  pmc_enable_periph_clk(ID_ADC);
//  adc_init(ADC, SystemCoreClock, ADC_FREQ_MAX, ADC_STARTUP_FAST);
  adc_init(ADC, SystemCoreClock, 21000000UL, ADC_STARTUP_FAST);
  NVIC_EnableIRQ (ADC_IRQn);               // enable ADC interrupt vector
  adc_disable_all_channel(ADC);
  adc_enable_interrupt(ADC, ADC_IER_RXBUFF);    <<--- THIS SHOUD BE ADC_IER_COMPE
  adc_set_bias_current(ADC, 0x01);
  //  adc_enable_tag(ADC);
  adc_enable_channel(ADC, ADC_CHANNEL_7);  // AN0
  adc_enable_channel(ADC, ADC_CHANNEL_6);  // AN1
  adc_enable_channel(ADC, ADC_CHANNEL_5);  // AN2
  adc_enable_channel(ADC, ADC_CHANNEL_4);  // AN3
  adc_start(ADC);
}

void ADC_Handler (void)
{
  if((adc_get_status(ADC) & ADC_ISR_RXBUFF) == ADC_ISR_RXBUFF) {   <<-- AGAIN "COMPE"
    // YOUR ACTION ON EVENT
   }
}
44  Products / Arduino Due / Re: Converting SPI code from an UNO to the Due on: July 31, 2014, 09:19:16 am
It's better if you post your altered code.
Code:
  attachInterrupt(0, UpdatePointer, FALLING);
 
  SPI.begin();
  SPI.setDataMode(SPI_MODE3);
  SPI.setBitOrder(MSBFIRST);
  SPI.setClockDivider(8);
Brief checking with data sheet,  2 MHz clock maximum, I'd set SPI.setClockDivider at least 42, DUE running at 84 MHz.
And also, interrupt 0, I know on UNO it's pin 2 , but I'm not sure if it same on DUE.
45  Using Arduino / Sensors / Re: Reading an oxygen sensor on: July 31, 2014, 06:39:32 am
I'm not following your math, have you graduated school in Canada?
5 / 2^23 = 0.000000298, so your ADC resolution 0.3 uV .
60 mV / 0.3 uV = 60 000 uV / 0.3 uV = 200 000
100 % / 200 000 = 0.0005 % resolution.

Having 4 mV sensors output range, as it says in data sheet, still:
4 mV / 0.3 uV = 4 000 uV / 0.3 uV =  13 333
100 % / 13 333 = 0.0075 % resolution, pretty close to your 0.01 % objective

Pages: 1 2 [3] 4 5 ... 175