I have an etape liquid level sensor http://www.adafruit.com/datasheets/eTape%20Datasheet%2012110215TC-12_040213.pdf hooked up to my raspberry pi model b through an MCP3008. The MCP3008 is connected following these instructions http://www.geeklee.co.uk/2014/01/12/rpi-mcp3008-tmp36-sqlite-lighttpd/. The eTape's second pin is wired to GND and the third pin is wired to CH0 of the MCP3008, with a 560 Ohm resistor between, connected to 3.3v, as instructed on the tutorials tab of the product page. The code is from the geeklee link
#!/usr/bin/python
import spidev
import time
spi = spidev.SpiDev()
spi.open(0,0)
def read_spi(channel):
spidata = spi.xfer2([1,(8+channel)<<4,0])
print("Raw ADC: {}".format(spidata))
data = ((spidata[1] & 3) << 8) + spidata[2]
return data
try:
while True:
channeldata = read_spi(0)
voltage = round(((channeldata * 3300) / 1024),0)
temperature = ((voltage - 500) / 10)
print("Data (dec) {}".format(channeldata))
print("Data (bin) {}".format(('{0:010b}'.format(channeldata))))
print("Voltage (mV): {}".format(voltage))
print("Temperature: {} degC".format(temperature))
print("-----------------")
time.sleep(1)
except KeyboardInterrupt:
spi.close()
When dry, spidata output looks like this:
RAW ADC: [0, 2, 199]
Voltage: 2291.0
When submerged roughly 5.5 inches:
RAW ADC: [0, 2, 23]
Voltage: 1724.0
The sensor appears to be working but I would like to calculate the ohms, in order to follow the datasheet. I am guessing I need to know the amperage to figure out ohms but am having trouble finding it. I also would like to test this with my multimeter and was wondering the best place to test this in the circuit. I would think the wire going from inbetween the etape and resistor to the ADC would be best.
Any help is appreciated, I am a noob when it comes to electronics.