A soil moisture level sensor based on ATTINY44. Uses capacitive sensing.
More info at http://wemakethings.net/chirp
Contact: mic a wemakethings.net
A soil humidity level sensor based on ATTINY44. Uses capacitive sensing.
A soil moisture level sensor based on ATTINY44. Uses capacitive sensing.
More info at http://wemakethings.net/chirp
Contact: mic a wemakethings.net
Since I have multiple plants next to each other I was thinking about powering them with a rechargeable lithium cell.
Would Chirp work with 4.1-3.3 V input? What is the tested operating range?
Hello,
I somehow bricked the I2C-communication to my sensor, probably in the process of assigning a new address, and before I try to reflash it, I want to ask the question above.
The version in /src is 2 years old and does not contain a version number. Besides it still does not include this PR: #11
Thanks a lot and best regards
Christian
I2C addresses are 7bits; the 8th bit is reserved for the protocol to indicate whether a read or a write is intended. If one accidentally writes an invalid address, then it "bricks" the device as a sensor, and one must use an avr programmer to manipulate eeprom manually or erase the contents and reprogram.
https://www.totalphase.com/support/articles/200349176-7-bit-8-bit-and-10-bit-I2C-Slave-Addressing
Hi,
I've read your writeup about using transistors to discharge C1 faster, but on the latest version I can find in your repo, I see no trace of those trasnsistors. Have you moved to a simpler design? If so, can you explain why?
Thanks for sharing your project!
Hi
What numer part is diode schottky, mofet N and "diode sod80c"?
Thanks
Hey, sorry this is not really an issue per say, except maybe a documentation issue. Are external pull-up resistors required if you are using the stand-alone sensor version to interface with an Arduino over I2C?
I don't see any in the schematics, but maybe I missed something. If indeed they aren't there, might not be a horrible idea to put pads on the PCB to (optionally) populate them.
Hi, I am having trouble getting anything useful from the Chirp! over I2C.
I am having trouble interfacing with it on both the raspberry pi and arduino. I soldered on some headers and tried to connect it to the raspberry pi. I did the following steps
Chirp! -> PI
VCC -> 3.3V
GND -> GND
SDA -> SDA1
SCK -> SCK1
Pin 1 -> Left unwired
Pin 5 - Left unwired
I am using the following code from your github readme
import smbus, time, sys
class Chirp:
def init(self, bus=1, address=0x20):
self.bus_num = bus
self.bus = smbus.SMBus(bus)
self.address = address
def get_reg(self, reg):
# read 2 bytes from register
val = self.bus.read_word_data(self.address, reg)
# return swapped bytes (they come in wrong order)
return (val >> 8) + ((val & 0xFF) << 8)
def reset(self):
# To reset the sensor, write 6 to the device I2C address
self.bus.write_byte(self.address, 6)
def set_addr(self, new_addr):
# To change the I2C address of the sensor, write a new address
# (one byte [1..127]) to register 1; the new address will take effect after reset
self.bus.write_byte_data(self.address, 1, new_addr)
self.reset()
self.address = new_addr
def moist(self):
# To read soil moisture, read 2 bytes from register 0
return self.get_reg(0)
def temp(self):
# To read temperature, read 2 bytes from register 5
return self.get_reg(5)
def light(self):
# To read light level, start measurement by writing 3 to the
# device I2C address, wait for 3 seconds, read 2 bytes from register 4
self.bus.write_byte(self.address, 3)
time.sleep(1.5)
return self.get_reg(4)
def __repr__(self):
return "<Chirp sensor on bus %d, addr %d>" % (self.bus_num, self.address)
if name == "main":
addr = 0x20
if len(sys.argv) == 2:
if sys.argv[1].startswith("0x"):
addr = int(sys.argv[1], 16)
else:
addr = int(sys.argv[1])
chirp = Chirp(1, addr)
print chirp
print "Moisture\tTemperature\tBrightness"
while True:
print "%d\t%d\t%d" % (chirp.moist(), chirp.temp(), chirp.light())
time.sleep(1)
At first, I would get:
<Chirp sensor on bus 1, addr 32>
Moisture Temperature Brightness
Traceback (most recent call last):
File "chirp.py", line 57, in
print "%d\t%d\t%d" % (chirp.moist(), chirp.temp(), chirp.light())
File "chirp.py", line 29, in moist
return self.get_reg(0)
File "chirp.py", line 12, in get_reg
val = self.bus.read_word_data(self.address, reg)
IOError: [Errno 121] Remote I/O error
Then, I hit the button on the chirp right before I ran the code and started getting this
pi@raspberrypi:~ $ python chirp.py
<Chirp sensor on bus 1, addr 32>
Moisture Temperature Brightness
65535 65535 65535
65535 65535 65535
I have checked the reviews and the open issues on the Arduino library from Apollon77 and I even tried adding a 10K pullup on both i2c lines and still get similar results. The only time it seems to work is the first time it runs on arduno code, but then goes back to 65535 readings.
Do you think this is a hardware issue? Do you have any guidance? I have tried this with 2 Chirp!'s and still the same thing.
I would like to ask you for the firmware for the old version of the device. Can I download a hex or bin firmware file somewhere? I want to restore the operation of a broken device, thanks in advance!
Hello, thanks for this device and your time, I plan on read this from an esp board, can i keep the coin cell? I do not know how much will it last.
Also, i plan on having more than one device on the bus, how do i change the addess?
thanks :)
The CERN OHL states that it "does not apply to software, firmware, or code loaded into programmable devices".
How would feel about specifying a license for the code you've provided? MIT is a favorite of mine.
When I have the sensor hocked up to I2C and I use the reset on the top of the sensor, can it happen that the read out registers switches. Moisture then is read from the register for light and the other way around.
I do not know if this depends on the producer. I do not now if this can be fixed by software. I can reveal that my hardware does not respond with temperature data. So maybe is it only the product I have in hand? - Be aware from where you buy, if the temperature sensing is important. Try out a small quantity first.
One should be prepared for sanitizing the switched data afterwards or maybe even build in an automatic sanitation.
The moisture values runs from around 300 to close to 500 (covered by hand). The light values from zero when full lid by for instance a flashlight, to close to 9000 when I cover it with my one hand (could maybe be more when absolute dark is reached?). - I do not know if these figures are different on hardware from other producers.
I have three plants, and I bought 3 sensors for each of them. I'm using an ESP8266 as I2C master and a Raspberry Pi as the controller.
But on ESP8266 I could use only 2 GPIOs as SCL and SDA. Is it possible to connect 3 chirps at the same time using the same i2c bus?
(sorry the question might be silly, I'm kind of rookie about this..)
The default I2C address is 0x20. where on the device does one change this default? By what method?
Thank you!
I use both sensors hooked up individually to a raspberry pi without pull up resistor on a 2 meter cable.
Its a desperate efford to get this soil moisture sensor working with mycodo.
The readout is fluctuating between a around 6000 to 240 to 0. Atm its in the soil.
Here is the data communication with the raspberry pi read with a logic analizer.
W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x98·W[0x20]·0x9C·W[0x20]·0x98·W[0x20]·0x48·W[0x20]·0x4C·W[0x20]·0x48·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0xD8·W[0x20]·0xDC·W[0x20]·0xD8·W[0x20]·0x48·W[0x20]·0x4C·W[0x20]·0x48·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09·W[0x20]·0x29·W[0x20]·0x2D·W[0x20]·0x29·W[0x20]·0x09·W[0x20]·0x0D·W[0x20]·0x09...
I hooked up a saleae
soil moisture sensor.zip
The chirp I often fail to bring in i2c mode. Is there a trick to do this from the start and skip the whole chirping?
The chirp hw version is 1.1 and the sensor 2.78
I will write some documentation on this.
My sensors are Soil moisture sensor 2.7.8 , 2.7.6 and chirp 2.4
38 -39.6% | 0.0°C | 15617
1 -46.9% | 0.0°C | 106
302 12.2% | 31.7°C | 106
304 12.5% | 31.7°C | 106
306 12.9% | 31.7°C | 105
305 12.7% | 31.7°C | 106
306 12.9% | 31.7°C | 105
304 12.5% | 31.6°C | 105
0 -47.1% | 0.0°C | 15616
15617 3015.1% | 1254.5°C | 12801
304 12.5% | 31.7°C | 104
I tried flashing a firmware on one with make hex make program which executed successfully and set the fuses but now it doesn't turn on anymore. I have a second one though.
I found some more sensors from you, they also don't work in mycodo so I opened an issue here kizniche/Mycodo#1216 regarding that.
I tried chirp-rpi out and the output is much more stable but it too get these high values from time to time and after some waiting, reading fails completely and i2cdetect takes ages and ultimately fails to detect the sensor.
Also I got rid of the cable so that its now 8cm long.
I propose the state of timer0 is restored after messing with it. I hooked up a NRF24L01+ module which unfortunatly needs the delay function to work properly.
My workaround is a little bit crude:
uint8_t save1;
uint8_t save2;
uint8_t save3;
void setup (void) {
save1 = OCR0A;
save2 = TCCR0A;
save3 = TCCR0B;
// Restore mess made by capacitance measurement
PRR &= ~_BV(PRTIM0);
OCR0A = save1;
TCCR0B = save3;
TCCR0A = save2;
I wanted to re-flash the chirp, to learn a bit more about how this all works.
I have looked through the repo, and as far as i can tell the standalone code lives in PlantWateringAlarm/src/
and to compile and upload to the device, i simply run sudo make program
.
this will compile the code, set the fuses and upload the firmware.
I am not 100% sure on what is in the programmer directory, but i assume it is to use a microcontroller as programmer for ISP headers?
Can someone confirm this?
cheers
In order to disable BOD during sleep (see Table 7-1 on page 33) the BODS bit must be written to
logic one. This is controlled by a timed sequence and the enable bit, BODSE in MCUCR. First,both BODS and BODSE must be set to one. Second, within four clock cycles, BODS must be
set to one and BODSE must be set to zero.
I think the current implementation violates the "4 clock cycle rule". OR ing the bits takes too much time. This results in an power down current consumption of ~27µA (BOD is active if not disabled by fuses).
I propose the following implementation of the sleep function.
void inline sleep() {
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
//MCUCR |= _BV(BODS) | _BV(BODSE); //disable brownout detection during sleep
//MCUCR &=~ _BV(BODSE);
uint8_t mcucr1 = MCUCR | _BV(BODS) | _BV(BODSE);
uint8_t mcucr2 = mcucr1 & ~_BV(BODSE);
MCUCR = mcucr1;
MCUCR = mcucr2;
sleep_cpu();
sleep_disable();
}
There might still be room for improvement (https://github.com/LowPowerLab/LowPower/blob/master/LowPower.cpp#L41) but this solution works for me.
Now my chirp consumes only 6µA instead of 27µA during power down.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.