Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Reading PWM in and converting to DC output on: February 10, 2014, 04:33:04 am
This is sort of in the same vein as the posts above, so hoping someone can help. I think I am almost there, just a bit confused about anologRead/Write
What I am trying to do. Use a variable capacitor to measure fuel depth, with a reference capacitor (for temperature stability) outputting to an Arduino Pro Mini.
From this Pro Mini I want to output a 0-5v signal proportional to the fuel level to be input to another remote Pro  Mini to be used to display  a bar on an LCD.
Why 2 Pro Minis?, because  I need to keep the leads, both shielded and short from the variable capacitor/fuel sensor to the 1st Pro Mini to avoid interference and
I have another Pro Mini driving an LCD and receiving other sensor inputs remote from the fuel tank.I am assuming the proportional voltage output will not be subject
to the same interference.
I am OK with the CapacitiveSensor part of the sketch, having that running fine. Also the display part on the 2nd Pro Mini.
All based on  http://www.instructables.com/id/Building-a-Capacitive-Liquid-Sensor
The bit I am not sure of is getting the "fuel" value turned into a voltage to send to the second Pro Mini.I have attempted to write that part of the sketch, but am confused
with analog read and write. I do know that the PWM output must be run through a low pass RC filter of something like 5koms and 10uF

Sketch below

#include <CapacitiveSensor.h>
CapacitiveSensor   cs_5_6 = CapacitiveSensor(5,6);// variable capacitor made of two concentric aluminium tubes. Centre connected to 6 with 1Mohm connected between 5&6, outer to ground.
CapacitiveSensor   cs_7_8= CapacitiveSensor(7,8);// Reference capacitor equal to variable cap on empty.Connected to 7 with 1Mohm connected between 7&8, other to ground.

int val=0;
void setup()
{
Serial.begin(9600);
}
void loop()
{  long fuel;
   long Ref;
  fuel = cs_5_6.  capacitiveSensorRaw (200);
  Ref = cs_7_8.  capacitiveSensorRaw (200);
  fuel = fuel-Ref-200;
  //Adjust 200 in line above to read fuel as 0 for tank on empty, then uncomment line below
 
 //fuel = fuel / 44;
  //Adjust 44 in line above to give fuel = 255 or  1023 with tank full, not sure which???
 
 
  //THIS NEXT BIT IS THE BIT I HAVENT QUITE GOT YET.
 
  analogWrite(3,fuel); // write the resulting value of fuel to digital pin 3 or analog pin 3??
  delay (50);
  val=analogRead(3); //Read the value of pin 3 and assign as val
  delay (50);
  analogWrite(2,val/4);//Send val to pin 2 to use as a voltage varying between 0 at empty and 5 volts to be read as an input to another Arduino.
  //This output to be run through a low pass RC filter, using 5kohm and 10uF.
 
{
Serial.print(fuel);
 Serial.println("Fuel");//debug fuel
 }
 
  delay (100);
}


2  Using Arduino / Displays / Re: Serial LCD Display from Parallel on: February 13, 2011, 05:54:12 pm
Youre right-no point doing if I do not have the bits already and would spend more than just buying the correct Serial LCD .
I thought it was going to be simpler.
Thanks for your help ,anyway.
3  Using Arduino / Displays / Re: Serial LCD Display from Parallel on: February 13, 2011, 03:37:23 pm
Jan
Just re-reading your reply . I dont think I made it clear -I have ANOTHER Pro Mini ,other than the one being used for the flight Control unit in the diagram.
Is the answer ,still ,No?
4  Using Arduino / Displays / Re: Serial LCD Display from Parallel on: February 13, 2011, 03:25:23 pm
Jan D
Thanks . I realised I could just buy a Serial enabled LCD or a back pack ,but was hoping  with the parallel LCD and the pro mini I already had , I could make it work .
Seems the answer is -No . smiley-sad
5  Using Arduino / Displays / Serial LCD Display from Parallel on: February 13, 2011, 03:12:40 pm
Please can someone help me with how to create a serial LCD display  from this Parallel display
http://www.pololu.com/catalog/product/772
and a 5v Pro Mini board ,both of which I already have.

I have them set up at present for The "Hello World " tutorial ,but want to use it as the LCD as shown in the top left of the attached diagram to read some flight control parameters
http://www.rcgroups.com/forums/attachment.php?attachmentid=3679886.

My level of expertise is -novice . I understand how to compile and upload an Arduino sketch and undertake the most basic of editing. I have completed some of the simple Arduino tutorials ,including Hello World.

I am hoping the answer is as simple as uploading a  new sketch to the Pro Moni and being told which pro mini ternminal to use for the single wire input.

Hope someone can help
Thanks
Patrick
6  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Newb with Pro Mini on: January 21, 2011, 06:29:14 am
Answered my own question-dodgy bread board connection  :smiley
7  Forum 2005-2010 (read only) / Frequently-Asked Questions / Newb with Pro Mini on: January 21, 2011, 04:32:19 am
Just starting to use Pro mini .Loaded Arduino and have Blink working.
Experimented with changing the flashing durations by editing and reloading the code, and that all works fine
Now trying to change the flashing to a different pin from pin 13 by changing the "13" in the code to other pin numbers -tried 9,10,11and 12 but no joy.
Powering and loading via FTDI Basic Breakout - 5V
Help please!
 :-/
Pages: [1]