Show Posts
Pages: 1 [2] 3 4 ... 174
16  Using Arduino / General Electronics / Re: level shift DAC output on: September 04, 2014, 09:01:53 am
I was wander, what is required update rate? How often do you need to re-position your piezo? Probably, not too fast, as piezo 'd be bad choice with it's high capacitance.  
 If so, than why to get all this struggle with analog design, instead of using PWM? You 'd get better resolution - up to 16-bits, simple circuits, 1 transistors with a few caps and resistors .  Couple inductors 'd make nice 2-nd order LPF
17  Using Arduino / Motors, Mechanics, and Power / Re: Hopefully easy for the pros on: September 04, 2014, 08:05:56 am
Glad to hear the issue is solved. Yes, it's confusing when pin declared as input provides a voltage,  at least if it's not so , someone 'd "intuitively" look into software
18  Using Arduino / Motors, Mechanics, and Power / Re: Hopefully easy for the pros on: September 04, 2014, 07:18:27 am
To OP: Have you decided to ignore reply #2, or I'm "invisible ghost" on this forum?
19  Using Arduino / Motors, Mechanics, and Power / Re: Hopefully easy for the pros on: September 03, 2014, 10:04:05 pm
Common error is missing pinMode(x, OUTPUT) declaration in the setup. Voltmeter shows pull-up resistor at digital input
20  Using Arduino / Sensors / Re: Can I use Ultrasonic Range Finder as a speed radar? on: September 02, 2014, 08:57:49 pm
May be interesting project, have you estimate the variation in freq.? What is the medium, than flow speed / ultrasonic speed.
21  Products / Arduino Due / Re: Due DigitalRead() threshold voltage on: August 31, 2014, 05:03:59 pm
Quote
V IL Input Low-level Voltage PIOA/B/C/D/E/F[0-31]             -0.3                                  0.3 x V VDDIOV IH
 Input High-level Voltage PIOA/B/C/D/E/F[0-31]               0.7 x V VDDIO                   V VDDIO+0.3V
Hysteresis Voltage V       PIOA/B/C/D/E/F[0-31]
 except PA0, PA9, PA26, PA29, PA30, PA31, PB14, PB22, PC[2-9], PC[15-24], PD[10-30],
PE[0-4], PE15, PE17, PE19, PE21, PE23, PE25, PE29                 150 500 mV

Section 46.2
22  Community / Exhibition / Gallery / Re: 3D Ultrasonic Radar. on: August 20, 2014, 10:23:42 am
Updates, part 2.


Enjoy.
23  Using Arduino / Programming Questions / Re: Averaging multiple inputs only when connected using one standard sketch on: August 17, 2014, 11:59:09 pm
Quote
Unfortunately the end user won't be able to alter the sketch, so the pins have to remain analog from the start
He doesn't have to altered a sketch.  You setting pinMode command inside setup(), than reading status and use it in "if" statement.
Here is quasy code:
Code:
 
int an0 = 0;  // If "0" - disconnected, default state.
int an1 = 0;
int an2 = 0
void setup()
{
 Serial.begin(115200) ;
  pinMode(14, OUTPUT); // Analog 0
 digitalWrite(14, HIGH);
 delay(100);
   an0 =  digitalRead(14);
  pinMode(15, OUTPUT); // Analog 0
 digitalWrite(15, HIGH);
 delay(100);
   an1 =  digitalRead(15);
  pinMode(16, OUTPUT); // Analog 0
 digitalWrite(16, HIGH);
 delay(100);
   an2 =  digitalRead(16);
}

 loop()
{
if ( an0 ) --->> use data to average;
if ( an1 ) --->> use data to average;
if ( an2 ) --->> use data to average;
24  Products / Arduino Due / Re: Due Counter Overflow Interrupt Problem on: August 15, 2014, 08:52:14 am
The code in reply #2 I use in my latest project, where I need to cascade two timers,  chaining output TC0-0 to TC0-1, that gives me two freq. primary and another lower by /N, both synchronous. I'm setting SYNC in interrupt handler .

 Library, as I can see doesn't have an API to select external source.  SAM3X data sheet 'd explain all other details in the snippet,
25  Using Arduino / Programming Questions / Re: Averaging multiple inputs only when connected using one standard sketch on: August 14, 2014, 10:05:29 pm
I'd set analog pin as digital first, set pull-up and read status. If not connected, most likely you get 1. To make it work reliably, analog voltage has to be lower 2V and less tha 10k impedance.
26  Products / Arduino Due / Re: Due Counter Overflow Interrupt Problem on: August 14, 2014, 07:03:34 pm
It's not clear what external freq. is. You mixing up a library code with your own, and I'm afraid it's not gonna to work. Library seems to me doesn't have external events counting, so it's always running from internal clock, and what worse its setting different clock (preselector) based of the freq. you are setting up.
 If the objective of your project to count external pulses with highest possible resolution , max freq. 42 MHz - limited by input pin synchronization circuits, than timer overrun in 4294967296/42000000 = 102 sec. 
Anyway here a code snippets , that you will have to adjust in some way:
Code:
void tmB_setup ()
{
  uint32_t reg_val;
  pmc_enable_periph_clk (TC_INTERFACE_ID + 0 *3 + 1) ;  // clock the TC0 channel 1

  reg_val = TC_BMR_TC1XC1S_TIOA0;   <<<---- TC_BMR_TC1XC1S_TCLK1;  in your case, replace, and use Analog pin 5
  TC0->TC_BMR = reg_val;  <<<<--- selects External clock

    TcChannel * t = &(TC0->TC_CHANNEL)[1];
    t->TC_CCR = TC_CCR_CLKDIS; 
    t->TC_IDR = 0xFFFFFFFF;     
    t->TC_SR;                   
    t->TC_CMR = TC_CMR_TCCLKS_XC1 | //  Because TC0 Channel-1
          TC_CMR_WAVE |                  // waveform mode
          TC_CMR_WAVSEL_UP_RC |          // I'd leave it's as it is, and set 1000 000 or another "good" number instead of FFFFF
          TC_CMR_EEVT_XC1 |     //
          TC_CMR_ACPA_CLEAR | TC_CMR_ACPC_CLEAR |
          TC_CMR_BCPB_CLEAR | TC_CMR_BCPC_CLEAR ;
         
  t->TC_RC = frm_rate * 227;    // < here, 1000 000   
  t->TC_RA = 3;                 // whatever
  t->TC_CMR = (t->TC_CMR & 0xFFF0FFFF) | TC_CMR_ACPA_CLEAR | TC_CMR_ACPC_SET ;  // probably you don't need this
  t->TC_CCR = TC_CCR_CLKEN | TC_CCR_SWTRG ;  // re-enable local clocking and switch to hardware trigger source. 
  t->TC_IER =  TC_IER_CPCS;
  t->TC_IDR = ~TC_IER_CPCS;
//  NVIC_EnableIRQ(TC1_IRQn); // enable TC0 interrupts
}

void TC1_Handler(){
  uint32_t reg_val0 = REG_TC0_SR1; // vital - reading this clears some flag
                                   // otherwise you get infinite interrupts

// your code
}

27  Using Arduino / General Electronics / Re: Ultrasonic sensor circuit design on: August 14, 2014, 04:02:24 pm
Don't expect big changes in SNR,  compare to R10 (1M) R5 and R6 produced 100x times less noise.  Other things if you still want to make your own circuits, not coping anything else design,  I'd suggest to decrease a gain of 1-st stage, right now its close to 5000. If OPA is not oscillating, than its over limits of the OPA  anyway , at 40 kHz it's probably 100-250 at max,  don't have data sheet at hands, do your home work check it up
28  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
29  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.
30  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. 
Pages: 1 [2] 3 4 ... 174