Weird analog read values

Ok so my spark arrived today. Now I ran tinker and set all my analog pins to analog read. Their on the breadboard as they arrived.

Every pin is reading over 2000, with nothing connected to them

Anyone know why? As they should all be reading 0

The analog inputs are high impedance if left floating… they will float up up up and sometimes down.

Hook up a sensor, and for the moment make sure to add a small capacitor between the input you are using and the GND pin. Something like 0.01uF or even smaller would be sufficient to lower the impedance on the analog input and give you good readings.

1 Like

I have hooked a 1k resistor between ground and the input for now. Im just trying to figure out why my pir is being triggerd. On the pin when it is off I get a reading of 30. Wheb it triggers it reads 2800. Thats right. But it will randomly trigger for no reason. Has anyone else used a pir motion sensor from 3.3v?

Show me the spec sheet for the PIR, and I’ll try to figure out what’s wrong :wink:

Ok so its a HC-SR501

I know it says minimum voltage of 4.5 but it actually works with very low delay times. On longer ones it stays triggerd, goes low with no activity then triggers itself again

Ok so you can power your PIR sensor from the VIN and GND pins of the Core… then hook the output to D2 and set D2 as an input. The sensor output is actually two states 0V and 3.3V, so it’s a digital output. As far as false triggering… it’s possible that radio interference might be setting it off, try adding some decouping caps across the power supply of the PIR, like a 0.1uF cap. It also sounds like the sensor tries to calibrate itself during the first minute that it is powered on, so avoid motion or directly lighting during that time.

1 Like

Do you know something… I have been trying ti figure out how to get 5v as a seperate supply all day…

Did I think if using the vin pin to link over to the 5v from the usb? Did I heck! You have just saved me a lot of time and messing about. Thanks :slight_smile:

Now to see if the sensor works properly. As the vin pin was reading 4.78v so it should have just enough

EDIT: It seems to be working now. I didnt think to link to the vin because of the arduino vin pin going to a different regulator to the main where as the core doesnt. So now I have a 5v and a 3.3v rail.

Just been to change my ldr now. An analog input so on my arduino it dropped by 300 in full light. On the core it still only drops 300; it just doesnt have a big enough resistance value to get a good light measurement.

Thanks for all the help :slight_smile: I never used anything but the arduino uno before which had the pull downs to stop the floating on the analogs where as the core doesnt :slight_smile:

Thanks again

Great to hear @bigjme!

I’ve been thinking for a while now that the VIN pin is going to be a trap for most arduino users, because VIN on the arduino can be be higher than the Spark Core… it probably should be a different label like V+ to force users to wonder what it’s purpose and voltage range is. @mohit :wink:

Yeh I think so :-p
Now to sort out my fet and get my time of day request sorted. I think I may have to order another core now… because I can

I can see how that can be confusing. VIN seems to be a commonly adopted term, but when navigating the Arduino-land, people might generalize things. I’ll propose a change here.