Go to advanced search

by ghp
Mon Jun 21, 2021 6:19 pm
Forum: Automation, sensing and robotics
Topic: 3d printed Weather Station
Replies: 3
Views: 109

Re: 3d printed Weather Station

Hmm, inside the method anemometer() you define three other methods. (It looks as if you try to build a class 'Anemometer', the init()-method points to this direction.) Assuming you want to invoke both calculate_elapse and calculate_speed inside the function anemometer, then the following could work....
by ghp
Mon Jun 21, 2021 4:55 pm
Forum: Automation, sensing and robotics
Topic: 3d printed Weather Station
Replies: 3
Views: 109

Re: 3d printed Weather Station

How do I detect a switch (button) "pressed" and interrupt the main program to collect a sample (wind speed) then resume the main program?
Look for "Threaded callbacks" in https://sourceforge.net/p/raspberry-gpi ... ki/Inputs/
by ghp
Mon Jun 21, 2021 3:36 pm
Forum: Automation, sensing and robotics
Topic: Programming for a ship model
Replies: 55
Views: 4932

Re: Programming for a ship model

The Adafruit Motor/Stepper/Servo Shield for Arduino v2 - v2.3 Kit has the PCA9685 on board. See the schema https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/resources for more information. The logic voltage is probably this solder jumper Capture.PNG . The 5V to center seems to have a t...
by ghp
Mon Jun 21, 2021 9:17 am
Forum: Python
Topic: PingServer from gpiozero
Replies: 1
Views: 63

Re: PingServer from gpiozero

Looks as if PingServer - when intially successful - does not run the 'when_activated' method. I had to break my network connection to get the when_**-methods being executed ( I guess breaking the network here is simpler than breaking google. And it took prox 60sec for the PingServer to recognize the...
by ghp
Sat Jun 19, 2021 7:34 am
Forum: Python
Topic: Initializing variables in a class
Replies: 11
Views: 328

Re: Initializing variables in a class

right?
right !
by ghp
Fri Jun 18, 2021 6:32 am
Forum: Python
Topic: Initializing variables in a class
Replies: 11
Views: 328

Re: Initializing variables in a class

Python classes provide an __init__ method which is the 'constructor'. See https://docs.python.org/3/reference/datamodel.html#object.__init__ For your code, it could look like this: class LEDStrip: def __init__(self, pin, numPixels, brightness=0.2): self.numPixels = numPixels self.brightness = bright...
by ghp
Thu Jun 17, 2021 2:25 pm
Forum: Automation, sensing and robotics
Topic: Raspberry Pi and sensors in a PCB using Easyeda
Replies: 11
Views: 475

Re: Raspberry Pi and sensors in a PCB using Easyeda

fritzing has an option to design PCB from the breadboard sketch. See https://fritzing.org/learning/tutorials/designing-pcb/ Instead of using the Pi, use a 'generic shrouded pin header' with 40 pin (where you solder a pin header later which is attached to pi). Use the 'fritzing fab', pay some money a...
by ghp
Wed Jun 16, 2021 6:07 pm
Forum: Python
Topic: SparkFun Qwiic Single Relay GUI
Replies: 2
Views: 191

Re: SparkFun Qwiic Single Relay GUI

You need a frontend (aka GUI) and a backend (aka hardware interface). Unlikely you find exactly this combination. For the frontend, you can use a simple GPIO on/off think like https://www.raspberrypi.org/forums/viewtopic.php?t=261675 The backend is I2C, there are example available https://github.com...
by ghp
Wed Jun 16, 2021 6:14 am
Forum: Python
Topic: Storing Motor DutyCycle so I can increase and decrease
Replies: 2
Views: 199

Re: Storing Motor DutyCycle so I can increase and decrease

Simple solution: a variable named motor1_current_dutycycle on global scope and refer to it with "global motor1_current_dutycycle" in the code. motor1_current_dutycycle = 50 def a_method(): global motor1_current_dutycycle motor1_current_dutycycle += 20 Drawback is that you have the checks f...
by ghp
Mon Jun 14, 2021 5:40 pm
Forum: Automation, sensing and robotics
Topic: Running Ultrasonic Sensor on RP4 with MCP3008
Replies: 11
Views: 498

Re: Running Ultrasonic Sensor on RP4 with MCP3008

The sensor supports a min and max set potentiometer. Try to change their settings. Perhaps the current set range is too narrow. There is also a remark in the datasheet "Mounting Consideration:The performance of this sensor can be influenced by direct metal contact.This zone is12mm/.50"meas...
by ghp
Sun Jun 13, 2021 4:44 pm
Forum: Python
Topic: Python omx wrapper while true /closes after a few hours
Replies: 1
Views: 183

Re: Python omx wrapper while true /closes after a few hours

Modified the script a bit and have it running here on a pi4 since 24h. Basic change is to add a small delay which limits the DBUS polling rate to 5Hz. And tried to make it polite and paused the video before setting new position(although I think this is not root cause of the problem). #!/usr/bin/env ...
by ghp
Sat Jun 12, 2021 10:01 am
Forum: Python
Topic: Flask: How to make this page not reloading?
Replies: 6
Views: 360

Re: Flask: How to make this page not reloading?

Add REST API for switching the LED to the flask app. Many tutorials, e.g https://pythonbasics.org/flask-rest-api/ Add the REST API calls to your web page, this requires javascript. Many tutorials, e.g. https://stackoverflow.com/questions/36975619/how-to-call-a-rest-web-service-api-from-javascript or...
by ghp
Fri Jun 11, 2021 9:50 pm
Forum: Automation, sensing and robotics
Topic: Running Ultrasonic Sensor on RP4 with MCP3008
Replies: 11
Views: 498

Re: Running Ultrasonic Sensor on RP4 with MCP3008

Connect all GND together: GND-Sensor (from the 24V) ------ GND Voltage divider ------ AGND ADC pin 14 ------- DGND ADC pin 9 ------- GND Pi First approach is: just connect them together. Second approach: when you worry about sub-millivolt, the ultimate bit of performance, noise, thermal effects, dri...
by ghp
Fri Jun 11, 2021 7:43 pm
Forum: Automation, sensing and robotics
Topic: Running Ultrasonic Sensor on RP4 with MCP3008
Replies: 11
Views: 498

Re: Running Ultrasonic Sensor on RP4 with MCP3008

The values of 22, 10 Ohm are far too low. The datasheet says min 500 Ohm (meaning more is possible) for the total load. In the sketch a proposal. And I think you missed the GND connection. The voltage divider, ADC and PI have a common GND line. Double check the voltage divider resistors that GND is ...
by ghp
Fri Jun 11, 2021 5:20 pm
Forum: Automation, sensing and robotics
Topic: Running Ultrasonic Sensor on RP4 with MCP3008
Replies: 11
Views: 498

Re: Running Ultrasonic Sensor on RP4 with MCP3008

How do you connect the sensor to the ADC chip ? Sketch and photo is helpful. How do you scale down the Sensor voltage output (0..10V) to (0..3.3V) for the ADC ? Does the voltage across the sensor (0..10V, load resistor 500Ohm or more) correlate with distance ? In the datasheet there is a remark abou...
by ghp
Thu Jun 10, 2021 4:19 am
Forum: Automation, sensing and robotics
Topic: Audio sensing
Replies: 3
Views: 297

Re: Audio sensing

Audio sensing is difficult.
Level sensing can be done with capacitive sensors.
Large scale https://www.instructables.com/Capacitiv ... el-Sensor/
Small scale: https://www.adafruit.com/product/4026
by ghp
Thu Jun 10, 2021 3:53 am
Forum: Python
Topic: Need help with finding library to generate tones via I2S mono amp and speaker
Replies: 4
Views: 268

Re: Need help with finding library to generate tones via I2S mono amp and speaker

Some years ago I used sonic-pi with an OSC interface. python-osc library is available. Did not check if the OSC api still exists. From my scratchClient code, here an untested snippet which you could use as a starting point: import socket try: import pythonosc import pythonosc.osc_message_builder exc...
by ghp
Wed Jun 09, 2021 7:47 am
Forum: Other projects
Topic: Inputting DMX to Raspberry Pi
Replies: 1
Views: 148

Re: Inputting DMX to Raspberry Pi

There is an arduino library for DMX, client and server. This can be a starting point for your code. The physical layer is identical to RS485. There are rs485 breakout for 3.3V available. The pi will be an end device, so you need to use a terminal resistor of 120 Ohm, most breakout board already cont...
by ghp
Wed Jun 09, 2021 7:39 am
Forum: Other projects
Topic: PI Zero W - Hottub Controller - Help needed
Replies: 11
Views: 404

Re: PI Zero W - Hottub Controller - Help needed

Think the GND connection of ULN to PI is missing in your description. (1) you need to connect GND of ULN2003 to GND of PI. Do not break this connection while system in operation. Best case use a soldered connection. (2) the relay current will flow through this wire. 70mA * 8, so ensure it is not too...
by ghp
Mon Jun 07, 2021 6:13 am
Forum: Python
Topic: Parse a text field with spaces into tkinter combobox
Replies: 2
Views: 131

Re: Parse a text field with spaces into tkinter combobox

Here a sample which seems to work. I use a list to collect the values and set this list into the combobox. # simulate a result from df command data = """Mounted on / /dev /dev/shm /run /run/lock /sys/fs/cgroup /boot /run/user/A B C """ import io buf = io.StringIO(data) ...
by ghp
Sun Jun 06, 2021 10:11 pm
Forum: Other projects
Topic: Excavator bucket position
Replies: 8
Views: 406

Re: Excavator bucket position

Build a small scale model (from plywood, broomstick or other cheap material), using RC servo to move the parts. Attach the sensors and check your algorithms whether you achieve the precision you need when the model is moving. As already discussed do not use magnetometer, will not work when steel is ...
by ghp
Fri Jun 04, 2021 10:49 am
Forum: Python
Topic: Get data from motionsensor with long cable
Replies: 1
Views: 82

Re: Get data from motionsensor with long cable

hall_connection.png The spec of this sensor is 5 to 15V, so I propose a separate power supply of 12V, a simple, low current 12V wall adapter is good for this. Current on hall output is prox 10mA. There are no data given for the sensor, but usually this should be possible. Use an optocoupler to isol...
by ghp
Thu Jun 03, 2021 8:17 pm
Forum: Automation, sensing and robotics
Topic: GPIO inputs lockout
Replies: 5
Views: 262

Re: GPIO inputs lockout

Some measures to protect inputs are in the following text (of course use 3.3V instead of 5V) https://www.digikey.de/en/articles/protecting-inputs-in-digital-electronics Optical isolation helps in difficult situations. Look for PLC input stage designs. E.g. https://www.edn.com/product-how-to-isolated...

Go to advanced search