Show Posts
Pages: [1] 2 3 ... 8
1  Using Arduino / Project Guidance / Re: RTC DS-1307 on: April 01, 2014, 01:38:52 pm
Instead, get the DS3231 RTC which is tempertaute compinsated and compatible with the DS1307 library and is good for around a minute or two a year.... and maybe $1 more in price. I swear by the DS3231 RTC.
My experience is that the DS3231 is considerably more expensive than the 1307--Mouser lists the 1307 for $3 each (qty 1), while the 3231 is about $9 each.  The improved accuracy is nice, though, as is the lower parts count to support (no crystal needed).
2  Using Arduino / Programming Questions / Re: error: statement cannot resolve address of overloaded function - Uart.println on: March 19, 2014, 04:23:05 pm
I did post all my code in my first post.  Upon further investigation, it looks like the compiler was flagging the wrong line as causing the error--it was actually the line where I wrote Serial.println;.  When I added the parens to that to read Serial.println();, the code now compiles.  I'll need to read up a bit on sprintf to get that expression correct, but it otherwise appears to be working as expected.
3  Using Arduino / Programming Questions / Re: error: statement cannot resolve address of overloaded function - Uart.println on: March 19, 2014, 11:50:24 am
I believe I'm using the Arduino libraries--I'm using the Arduino IDE, anyway; how would I determine what libraries I'm using?  I'm afraid I don't quite understand what "there is already an instance of the HardwareSerial class created" means with respect to my code--should I omit the line "HardwareSerial Uart = HardwareSerial();"?
4  Using Arduino / Programming Questions / error: statement cannot resolve address of overloaded function - Uart.println on: March 18, 2014, 05:50:49 pm
I'm working on some code on a Teensy 2.0 to read a pressure sensor, turn that input into a text string, and output that string using the onboard hardware serial.  Here's the code that I think is most directly relevant:

char outString[17];
HardwareSerial Uart = HardwareSerial();
float pressure = 0;

    Uart.println (outString);

When I attempt to compile, it errors out with the error in the subject, and the last line (Uart.println) marked.  A web search suggests that this error comes up when you forget a () following a function call, but that doesn't seem to be the case here.  Any ideas what's up?

As an unrelated question, I'm not at all sure my sprintf expression makes any sense.  What I'm trying to do is turn the pressure reading into a four-digit integer, padded with zeroes as appropriate.  So, if pressure=85.2, the string should read OPT,0085,0000.

Complete code is below:

const int sensorInPin = A0;
const int warningInPin = A1;
const int ledOutPin = 11;

unsigned long previousMillisPoll = 0;
unsigned long previousMillisFlash = 0;
unsigned long currentMillis = 0;
long pollInterval = 250; // poll every 250 ms
long flashInterval = 125; // 4 Hz flash (8 transitions/sec)

int ledState = LOW;
boolean warningFlag = false;
boolean debug = true;
int sensorValue = 0;
int warningValue = 0;
float pressureMultiplier = 4.982; // experimentally derived - divide sensor reading by this to yield PSI

char outString[17];

HardwareSerial Uart = HardwareSerial();

float pressure = 0;

void setup() {
  pinMode (ledOutPin, OUTPUT);
  if (debug == true) {
    Serial.begin (38400);
  Uart.begin (9600);
  warningValue = analogRead(warningInPin);

void loop() {
  currentMillis = millis();
  if (currentMillis - previousMillisPoll > pollInterval) {
    previousMillisPoll = currentMillis;
    sensorValue = analogRead (sensorInPin);
    pressure = sensorValue / pressureMultiplier;
    if ( sensorValue < warningValue) {
      warningFlag = true;
    else {
      warningFlag = false;
    Uart.println (outString);
    if (debug == true) {
      Serial.print ("Warning Value: ");
      Serial.println (warningValue);
      Serial.print ("Sensor Value: ");
      Serial.println (sensorValue);
      Serial.print ("Calculated Pressure: ");
      Serial.println (pressure);
      Serial.println (outString);
      Serial.println ;
  if (warningFlag == true && currentMillis - previousMillisFlash > flashInterval) {
    previousMillisFlash = currentMillis;
    if (ledState == LOW) ledState = HIGH;
    else ledState = LOW;
    digitalWrite (ledOutPin, ledState);
5  Using Arduino / General Electronics / Re: Reading 0-100 mV signal on: March 12, 2014, 08:18:17 am
Although an instrumentation amplifier is not an op-amp (per Analog Devices' app note on instrumentation amps), what's the practical difference, in this application, between using an op-amp wired as a differential amp, and using an instrumentation amp?
6  Using Arduino / Project Guidance / Re: How to make the Arduino and RTC work with the Daylight saving time? on: March 11, 2014, 12:27:53 pm
shouldn't it just synchronize with the pc? Or is it working on another principle?
Your RTC will automatically synchronize with the PC only if you've coded both the Arduino and your PC to do so.  There's nothing in your code that does that.  It tests to see if the RTC is running, and if not, sets it to a specified date and time.  You could code your project to query an attached computer for the time, but you'd also have to have some software on the computer to recognize and respond to that query (IIRC, one of the RTC examples has sample code for Processing to do that).  But there's no automatic updating going on.
7  Using Arduino / General Electronics / Re: Reading 0-100 mV signal on: March 11, 2014, 07:53:19 am
After messing around more with the LM358s and not getting expected results, on the advice of an EE friend I'm looking into an instrumentation amplifier.  The AD623 is a rail-to-rail device that will work in a single-supply mode, and seems to be giving much more sensible results.  It is, of course, quite a bit more expensive than the LM358, but a few dollars each is still pretty reasonable.  Thanks again for all the help on this.
8  Using Arduino / General Electronics / Re: Good quality cheap multimeter on: March 06, 2014, 01:52:48 pm
PS: Get one with a fuse that's easy to change otherwise you'll spend a lot of time wondering why the ampere readings are weird. Oh, wait, there's no such thing at any price.
Suggest you look at a Fluke 27.  I picked one up (used) for around $50 US through eBay.  When you open the battery compartment (two 1/4-turn latches), the fuses are accessible.  They're expensive to replace due to their construction, but they're easily accessible.  A number of other Fluke meters have easily-accessible fuses, but they're considerably more expensive.  The 27 is also built like a brick, autoranging, and should do everything you'd need to do with an Arduino.

Not sure how much you'd actually use the current measurement with Arduino projects, but it's there.
9  Using Arduino / General Electronics / Re: Reading 0-100 mV signal on: February 02, 2014, 03:57:57 pm
Measured the resistance among the four wires of the sensor.  Red and black are +/- in, respectively, and green/white are +/- out.
0 psi15.627k15.588k3.367k3.329k
50 psi15.673k15.555k3.334k3.377k
Still playing with the sample circuits.
10  Using Arduino / General Electronics / Re: Reading 0-100 mV signal on: January 29, 2014, 08:02:40 am
As polymorph requested, here's a (partial) schematic--I couldn't see a way to represent the sensor itself in Eagle without defining a whole new part.  It's connected as follows (red/black are +/- in, green/white are +/- out, according to the markings on the sensor):
  • Red to the output of the 7810
  • Green to pin 3 of the LM358
  • Black and white tied together, and to ground

I'll check resistances among the sensor terminals and report back.  I'll also try the differential amplifier circuit out of the datasheet--looks straightforward enough.
11  Using Arduino / General Electronics / Re: Reading 0-100 mV signal on: January 26, 2014, 10:20:38 pm
the LM358 is wired per 123Splat's reply #3 on the first page--I'll see if I can draw it up tomorrow.
12  Using Arduino / General Electronics / Re: Reading 0-100 mV signal on: January 26, 2014, 05:10:20 pm
OK, it's been a while since I last posted--between getting parts and traveling, I haven't had much chance to work on this in the last month.  I got a 358, an assortment of resistors and capacitors, a 7810, and a 7805, and assembled it all on a breadboard this afternoon.  I used a 56K resistor rather than a 50K, but otherwise as directed here.  I powered the 358 from the 7805, and the sensor from the 7810.  I tied the sensor input and output grounds together.

Likely as a result of tying the input and output grounds together, I got some unexpected results.  Where previously the output of the sensor was 0 V with 0 psi applied, it became 946 mV.  Instead of increasing 1 mV/psi, it increased about 0.5 mV/psi.

The output of the 358 was steady at 3.57V.  I suspected this was as close to Vcc as its output would go, so I tried powering it from the 7810 instead.  The results from that confused me.  With 0 psi and an input voltage of 946 mV, the output was 1.834V.  With 20 psi and an input voltage of 959 mV, the output was 1.826V.  At that point I stopped the test.

I understand that this wouldn't meet any kind of certification--this is for an experimental application, so that isn't a problem.

13  Using Arduino / General Electronics / Re: Reading 0-100 mV signal on: December 17, 2013, 03:17:56 pm
Unfortunately, I do not have a data sheet for the sensor; what I know of its characteristics has been determined by trial and error.  It came with an electronic module that was designed to be used with an aircraft engine instrumentation system.  When I applied power to the module, it was feeding 10 volts to the "in" terminals on the sensor.  Given that, I wired the "in" terminals on the sensor to a bench power supply set for 10 volts, applied air pressure in 20 psi increments, and measured the output.  In doing so, I was looking for stable readings in voltage, resistance, or current; what I got was a stable and repeatable 1 mV/psi result.

My goals are to light an LED when the pressure falls below a certain level, and also output the pressure over a serial line (a fallback would be to just manage the LED, but that should be achieveable without involving a microcontroller, I'd think).  I don't need lab-grade accuracy, but +/- 5% would be good.  The application I'll be using it in will be powered by a 14V DC bus, which I'm planning to regulate down to 5V for the Teensy, and to 10V for the sensor, using a 7805 and 7810 respectively.
14  Using Arduino / General Electronics / Re: Reading 0-100 mV signal on: December 17, 2013, 10:24:41 am
OK, op amp it is, and I'll look up the LM358.  Thanks for the input!

(later)  I've looked at the data sheet for the LM358, and it looks like the gain is set by the ratio of R2 to R1.  If I'm reading and understanding it correctly, this means that the 50k/10k combination would result in a gain of 6 (1 + R2/R1), amplifying 0-100 mV to 0-600 mV.  Is this correct?
15  Using Arduino / General Electronics / Reading 0-100 mV signal on: December 17, 2013, 09:28:39 am
I'm working on a project that needs to read a four-wire pressure sensor.  The sensor takes 10 V DC in on two wires, and outputs 0-100 mV DC, 1 mV/psi.  I need to read that voltage on an Arduino (actually a Teensy), convert it to a PSI measurement, light an LED if it's too low, and output the information over a serial line.  I'm OK on the software side of it, at least conceptually, but questioning how to read the voltage.

My best guess here is that, to get decent resolution, I need to convert 0-100 mV to 0-5 V.  My next guess is that I'd use an op-amp to do this.  From there, my guesses are running out--I've not had occasion to play with op-amps before, and I'm not even sure that they'd be appropriate here.  What would be the best (simplest, lowest parts count) way to accomplish this?
Pages: [1] 2 3 ... 8