Frustrated Noob - LED - Temp - Automated Aquarium - Raspberry Pi Forums


i think subject line covers bases of frustration. convinced pi handle of above bought idea. didn't buy being left hanging in breeze once purchase made. rope burns aside, let's address headaches. main goal: aquarium automation. goal: know what's going on @ glance. hardware: pi b, ds18b20 waterproof temp probe, 5 float switches, 2 12v nc valves, asst resistors, asst jumpers, tip120 transitors, 2 breadboards, necessary power supplies, waterproof led strips, approx 100 pages of code, 3 varieties of goldfish, 3 decent sized aquariums play with, 1 frustrated pi owner, 2 laptops, , partridge in pear tree. can guess 1 of not correct. printed lesson adafruit on temp sensor. cannot pi pick data sensor. verified voltage there, no data...gave after 2 days , googling empty results. today, found time try hand @ led strip lighting. let's i'm here , desk littered electronics. @ point in game, ready pack in box , forget exist until 3 years when have degree , need do. class schedule not cooperate , neither daytime job of filled-time caregiver either. , appreciated , please understand correspondence happen, may come late @ night eastern time usa "free" time split school , "fun" with. if can conquer this, next dream robotic observatory computerized telescope. stay tuned!! being first post, i'm copy/pasting desktop in case of mishap. thanks!!

to enable 1-wire bus (to read ds18b20) add following line /boot/config.txt , reboot.

dtoverlay=w1-gpio

default should connect ds18b20 gpio 4 (pin 7).

once connected (3v3, ground, 4k7 pull-up on data line 3v3, data line gpio 4) see several w1 related modules lsmod command.

following script read ds18b20 have connected pi.

code: select all

#!/usr/bin/env python  import glob import time  # typical reading # 73 01 4b 46 7f ff 0d 10 41 : crc=41 yes # 73 01 4b 46 7f ff 0d 10 41 t=23187  while true:     sensor in glob.glob("/sys/bus/w1/devices/28-00*/w1_slave"):       id = sensor.split("/")[5]        try:          f = open(sensor, "r")          data = f.read()          f.close()          if "yes" in data:             (discard, sep, reading) = data.partition(' t=')             t = float(reading) / 1000.0             print("{} {:.1f}".format(id, t))          else:             print("999.9")        except:          pass     time.sleep(3.0) 


raspberrypi



Comments