Show Posts
Pages: [1] 2 3 ... 172
1  Products / Arduino Due / Re: Converting SPI code from an UNO to the Due on: Today at 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.
2  Products / Arduino Due / Re: Analog Comparitors on: Today at 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
   }
}
3  Products / Arduino Due / Re: Converting SPI code from an UNO to the Due on: Today at 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.
4  Using Arduino / Sensors / Re: Reading an oxygen sensor on: Today at 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

5  Products / Arduino Due / Re: Converting SPI code from an UNO to the Due on: July 30, 2014, 10:04:01 pm
I noticed +5V, DUE is 3.3V devise. Make sure you don't apply more than 3.3, it's not tolerant.  Have a data spec. of the chip?
6  Products / Arduino Due / Re: SPI interrupt on: July 29, 2014, 08:47:17 pm
I think ,  SPI_Handler(void)
http://asf.atmel.com/docs/latest/sam.drivers.spi.example.sam3u_ek/html/spi__example_8c.html#a362497e8f44dbb1f6b5d0deb68eb1ff1
7  Using Arduino / Sensors / Re: Reading an oxygen sensor on: July 29, 2014, 08:23:39 pm
What I mean in my reply
Quote
you need 14-bits ADC with x1000 amplification OR 24-bit ADC
that you need amplification factor x1000 with 14-bits ADC. Other option, 24-bits ADC doesn't require amplifier.
I would try to set PGA to x1, first, see how much noise it's picking up from power line and environment.  Using higher value of amplification may complicate circuitry and demand good decoupling on the power supply lines.
8  Using Arduino / Sensors / Re: Reading an oxygen sensor on: July 26, 2014, 06:37:34 am
Throw the hole mounting package reduces a number to 29.
Than, you may search on the google "ADS1211 arduino tutorial", substituting different name of the ADC, you may even get "ADC-NNNN  arduino library, project, connection diagram and ready to eat use module- shield- device"
Nice book, btw: http://www.amazon.com/Arduino-For-Dummies-John-Nussey/dp/1118446372
9  Using Arduino / Sensors / Re: Reading an oxygen sensor on: July 25, 2014, 07:26:26 pm
http://www.digikey.com/product-search/en?pv153=19&FV=fff40027%2Cfff80183&k=adc&mnonly=0&newproducts=0&ColumnSort=0&page=1&quantity=0&ptm=0&fid=0&pageSize=25
10  Using Arduino / Sensors / Re: Reading an oxygen sensor on: July 25, 2014, 06:04:01 am
Quote
So a 10uF capacitor would smooth the signal eating up spikes and troughs?
Depends, where this spikes come from. there is a chance that interfering part is SPI bus. I don't think ADS1115 is good choice, it has only gain x16? There is only 13 - 9 mv = 4 mV span, you need 14-bits ADC with x1000 amplification OR 24-bit ADC. If you can get ADC they used in electronic scale, you may solved a problem w/o designing amplifier x1000, which may be not easy part for beginner. What kind of arduino do you have?
11  Using Arduino / Sensors / Re: Reading an oxygen sensor on: July 24, 2014, 10:31:50 pm
O'k, my crash course on sensor technology ended up with this : http://www.teknosofen.com/O2_fuel_cell_files/o2_cell_dissection.htm
that I think is correct, as product page mention NTC compensation and 3-lead connector  smiley-cool
You may put electrolitic cap 10 uF in parallel to 10 k resistor, response time is quite big anyway. 
It's strange you have a lot of noise, it may be indication of instability amplifier itself, than EMI from connecting wires
12  Using Arduino / Sensors / Re: Reading an oxygen sensor on: July 24, 2014, 07:02:02 pm
Well, that page doesn't tell much about output impedance, there is also no info where 9-13 mV coming from - where it is getting power and what is the voltage? How do you connect it's when you did initial test?
I think, if device has high output resistance, than the best option would be to place amplifier as close as possible, shielding everything (IC and board) .
13  Using Arduino / Sensors / Re: Reading an oxygen sensor on: July 24, 2014, 06:22:55 pm
Quote
could you suggest what components I should use in the circuit? obviously to start with a 10k ohm resistor in parallel to give the sensor a load and
What circuit? Post a link to data sheet of the sensor.
14  Using Arduino / Programming Questions / Re: Reading from the serial using a LTC2400 24 bit ADC on: July 24, 2014, 05:24:34 pm
http://interface.khm.de/index.php/lab/experiments/connect-a-ltc2400-high-precision-24-bit-analog-to-digital-converter/
15  Products / Arduino Due / Re: how long sin() function takes? on: July 24, 2014, 08:34:58 am
Quote
I declared the variable as volatile , but it didn't become better.
Right, it shouldn't.  Declaration volatile keeps compiler away from doing it's tricks, when you get 5 usec results - wrong results.
Pages: [1] 2 3 ... 172