Skip to content
Monitor soil moisture and water plant.
Assembly C PHP HTML Makefile C# Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cnc
fastboot
gui
img
reset
usbasp
.gitignore
Makefile
README.md
main.brd
main.c
main.sch

README.md

ATtiny13 Plant

Monitor soil moisture and water plant. Portable and high efficiency with lithium-ion batteries.

Photo

PCB

Screenshot

Designed with EagleCAD

BOM (Bill of Materials)

Part Value Package Function
IC1 ATTINY13A SOP-8 or DIP-8 CPU
C1 100nF 0805 or 0603 (104) CPU
T1A/B 2N4401 NPN TO-92 or SOT-23 Pump
R1 510R 0805 or 0603 (511) Pump
R2 10k 0805 or 0603 (103) Pump
LED1 Red 0805 or DIP-2 LED
R3 120R 0805 or 0603 (121) LED
T2A/B 2N4401 NPN TO-92 or SOT-23 Solar
REG1 7805L (5V) TO-92 Solar
C2 1000uF 7x7 mm Solar
R4 510R 0805 or 0603 (511) Solar
R5 10k 0805 or 0603 (103) Solar
R6 10k 0805 or 0603 (103) Sensor
- 3.7-4.2V Lithium Cell 18650 Battery
- TP4056 Lithium Charger Charger
- 10V+ 2x 5V Solar Cells Solar

Diagram

Screenshot

Solar

Optional Pin7 (PB2) used to "burst" charge from solar panel.

LED

Empty container detection - shared with Solar Pin7 (PB2)

Compile

Install "avr-gcc" and run "make".

MacOS

Windows

avr-gcc -std=gnu99 -Wall -Os -mmcu=attiny13a main.c -o main.o
avr-objcopy -O binary main.o main.bin
avr-objcopy -O ihex main.o main.hex

Download

MacOS MacOS

Windows Windows

Firmware Firmware

Flash

Option 1 - USBasp (Recommended)

sudo avrdude -p t13 -c usbasp -Uhfuse:w:0xFF:m -Ulfuse:w:0x6A:m -U flash:w:main.hex:i

USBASP

Option 2 - Raspberry Pi (Using linuxgpio)

sudo avrdude -p t13 -c linuxgpio -Uhfuse:w:0xFF:m -Ulfuse:w:0x6A:m -U flash:w:main.hex:i

PI

Install AVRDude.

sudo apt-get install avrdude

Open AVRDude configuration file for editing.

sudo nano /etc/avrdude.conf

In Nano, use ctrl-w to search for linuxgpio. This is the section that controls the GPIO pins used for programming. The section needs to be uncommented. Set the MOSI, MISO and SCK entries to the GPIO pins on the Pi.

programmer
  id    = "linuxgpio";
  desc  = "Use the Linux sysfs interface to bitbang GPIO lines";
  type  = "linuxgpio";
  reset = 12;
  sck   = 11;
  mosi  = 10;
  miso  = 9;

Bootloader (Optional - No Longer Used in Design)

Bootloader is usefull for updating the firmware over UART without desoldering the chip.

Compile

cd ./bootloader
make

One-Time Flash

sudo avrdude -p t13 -c linuxgpio -Uhfuse:w:0xEE:m -Ulfuse:w:0x6A:m -e -U flash:w:bootload.hex:i

Update (MacOS)

./fastboot/osx/bootloader -d /dev/cu.usbserial -b 9600 -p main.hex

Update (Windows)

./fastboot/win/FBOOT.EXE -C2 -B9600 -Pmain.hex

Note 1: Ready the chip for flashing by resetting it - short Pin4 (GND) and Pin8 (VCC) for 1 second.

Note 2: Disconnect UART Pin3 (RX) after flashing - sensor will read false-positive if UART has +5V.

Caution: RESET Pin1 (PB5) if fuses set HFuse 0xFE (or 0xEE), ATTiny13 can only be flashed once. Future flashing requires "High-Voltage programmer" to clear the fuse.

Debug

Use Serial to USB-TTL on Pin2 (PB3) + GND.

Note: Serial speed is 9600

Licenses

ATtiny13 Plant

CC0

Fastboot

BSD

You can’t perform that action at this time.