New answers tagged

0

Magic It is basically axiomatic that can't achieve "without losses". The best you can do is reduce them. Have a CPU local to the MPU9250 that reads the data. Read it repeatedly to ensure you got the right values. (Drat. I forgot to do this! Time to consider more updates.) Use a communication link between the local CPU and the controlling PI that uses at ...


1

why not use RS485 or RS422 as transfer layer. it will be more reliable, I think wireless can not ensure the stability, if your application has request on that, it's not a good idea. what you need is design a adaptor transfer message from i2c to uart or vice versa.


1

Thank you all for your help in diagnosing this. Relay was faulty, swapped for one of the same make and model and now its working with the test provided by Coder Mike, as well as my original script.


1

Does the following turn on and off your relay accordingly? import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) RELAIS_1_GPIO = 18 GPIO.setup(RELAIS_1_GPIO, GPIO.OUT) while True: print('on') GPIO.output(RELAIS_1_GPIO, GPIO.LOW) time.sleep(2) print('off') GPIO.output(RELAIS_1_GPIO, GPIO.HIGH) time.sleep(2)


2

That LDAC signal is truly nasty. I have read the datasheet and your messages a few times and I can't quite focus on a specific issue so I figure out you're just brainstorming. I will start from what I know from direct experience. How should I write this communication to be as orderly as possible - should I write special C routines within my Python ...


1

Setting a GPIO pin has a latching behavior. That is when you set it, it stays that same value until you tell it otherwise. So in your if statement, just add an else clause to reset it low if the value read is <=600: if touch > 600: GPIO.output(RELAIS_1_GPIO, GPIO.HIGH) print("moisture: " + str(touch)) else: GPIO.output(RELAIS_1_GPIO, GPIO....


1

OBSERVATION: I do not see a line of code / instruction to pull the GPIO back to low. If the observation is correct and this instruction is executed: GPIO.output(RELAIS_1_GPIO, GPIO.HIGH) How would the line GPIO return to a low state? Under what condition do you expect the GPIO to return to the low state? What happens if the instructions is changed to: ...


2

A few thoughts: Using dedicated I2C pins for your bit-banged I2C should be fine as long as you don't use smbus at the same time. Improving GPIO timing in userspace can be done by increasing process priority (see man nice). Re-writing your bit-banging routines in C will help on average, but the worst case will be just as bad as with Python. The only way to ...


Top 50 recent answers are included