serial port is constantly reading out values

hi everybody,

so I was playing around with an amplifier this morning and was having trouble with it (see the sensors forum page). anyhow, I finally gave up, but now whenever I read from serial I get a constant-ish value (it's around 300).

what the heck is going on? I have nothing plugged into my uno, so the serial port value should just be zero, but it's going crazy. I've tried different unos (including one straight out of the box) and I'm having the same problem. Could this be related to my USB cord? I can't think of anything else.

I'm running the example code AnalogReadSerial and my output looks like

256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256

ideas? thoughts? solutions?

thanks,

update: it's not the cord. I just tried a new one. could it be my computer? is there something that I can reset so that the serial monitor stops going crazy?

Just a thought…If you are still reading the analog input and sending it over the serial, and nothing is connected to the analog input, then it is floating. The reading on that input will vary quite a bit, depending on what types of electronic devices are around. My fluorescent desk lamp drives floating inputs crazy!

When I plug in the sensor, though, it still goes crazy. it reacts to the sensor, but it's also stuck at a high value....

What is "stuck at a high value"? 300 is not high. 1023 is high.

Remove the amp connections. Check the analog input with two resistors of equal value, somewhere between 2K and 10K. Connect one from ground to the analog pin, and the other from +5v to the analog pin. The value should be around 512.

Have you checked the output voltage of the amp with a voltmeter?

Also, a look at the code could be helpful :-)

I just took a quick look at the datasheet for your op amp. Is this it? http://www.ti.com/lit/ds/sbos110a/sbos110a.pdf

That is not really a good choice for powering with a +5v single supply. The common mode voltage is not good, and the output voltage is limited to (V+)-2 and (V-)+2. That means with a 5v supply, the output will vary from 2v to 3v.

Okay. Thanks surfertim. I'm new to this and don't really know what to look for in an amplifier. Is there a common one that people use for arduino? I just need something that will work fast (I want to collect voltages at about 10kHz)?

edit: holy cow I'm stupid.

thanks for the responses, guys. a resistor was missing in my circuit. I got really crazy about fixing this 'problem' that really didn't exist.

edit: holy crap I’m stupid.

thanks for the responses, guys. a resistor was missing in my circuit.

Whew!! It does happen to other people! I was beginning to think it was just me… :slight_smile: