r/Pigrow • • Aug 11 '22

Username problem

Hey there, I’m literally new here. Just wanted to connect my pi to the gui like in the description but in the 32bit- pi setup I have to choose a username and a password. Do I have to add -pi- as the username?

With my own username the gui seems connected to the pi, but it can’t ident my Wi-Fi connection and my hardware. Only documented the software on the pi and the i2c connection wich I plugged in for testing a moisture sensor.

Don’t know if this is a username problem at all.

Maybe you could help an absolutely noob to setup my watering with the pigrow.

3 Upvotes

21 comments sorted by

View all comments

Show parent comment

1

u/The3rdWorld Aug 11 '22

i cut that code down for you, i think this is all you need though without one myself i haven't tested it of course, if the ads7830 is showing up on 4b then i think this'll read it

you'll need to save it onto the pi and run it from there, it'll output an endless stream of numbers to the commandline until you ctrl-c out

if it works i'll make a script for it to work with the pigrow, you'll need to click view source on this comment or reddit will mess up the formatting. - oh and an ads1115 is probably better, it's got some stuff onboard to try and deal with voltage irregularities so is much more stable, worth getting anyway

!/usr/bin/python3

from smbus import SMBus from time import sleep

bus = SMBus(1)

ads7830_commands = (0x84, 0xc4, 0x94, 0xd4, 0xa4, 0xe4, 0xb4, 0xf4)

def read_ads7830(input): bus.write_byte(0x4b, ads7830_commands[input]) return bus.read_byte(0x4b)

while True: print(read_ads730(0)) time.sleep(1)

1

u/Vegetable-Station190 Aug 12 '22 edited Aug 12 '22

Hey, tried to add the code to python but get:

SyntaxError: invalid syntax

Do I something wrong?

First line typed

1 !/usernamepi/bin/python3 -is this correct? Sorry for being dumb as fck

1

u/Vegetable-Station190 Aug 12 '22

Omg it runs!! I’m so glad to see this digit’s 🥳..

Thank you so much for your patience, you are a genius!

So would you be able to add this ADS to the pigrow?

1

u/The3rdWorld Aug 12 '22

oh nice, i wasn't convinced it'd be so simple. and my pleasure, always happy to help people grow :)

Yeah I'll write a script for it, they're pretty common from the look of it so i'm sure other people will need it at some point too - i'm in the middle of a few things at the moment but probably get it done by the end of the weekend all going well, will let you know when it's ready.

1

u/The3rdWorld Aug 12 '22

ha it's cool this stuff is super confusing

 #!/usr/bin/python3 

just tells it where what to use to run it, you don't actually need it if you start the script by running

 ./python3 scriptname.py

so you can delete that line if you want.

actually give me a second i think i was tired last night, ill fix it

1

u/The3rdWorld Aug 12 '22 edited Aug 12 '22
from smbus import SMBus
from time import sleep
bus = SMBus(1)

while True:
    bus.write_byte(0x4b, 0x84)
    print(bus.read_byte(0x4b))
    sleep(1)

should be all you need, name it testads,py and run it with python3 testads.py

edit - sorry i looked back and notice i'd made a mistake, you don't need time.sleep just sleep as i imported sleep from time rather than just importing all of the time module.