Go to advanced search

by ghp
Sun Nov 28, 2021 2:25 pm
Forum: Python
Topic: Bluetooth GPIO.output script doesn't run (without errors), but GPIO.input worked.
Replies: 3
Views: 112

Re: Bluetooth GPIO.output script doesn't run (without errors), but GPIO.input worked.

Difficult, as I can't test this here. I'd propose to change the while(1): loop as follows: state = None while True: if GPIO.input(6) == 1: new_state = 'on' else: new_state = 'off' if state != new_state: s.send( new_state + "\n") state = new_state This avoids to send current state again and...
by ghp
Sun Nov 28, 2021 9:11 am
Forum: Python
Topic: Bluetooth GPIO.output script doesn't run (without errors), but GPIO.input worked.
Replies: 3
Views: 112

Re: Bluetooth GPIO.output script doesn't run (without errors), but GPIO.input worked.

Perhaps your receive-sample is missing the lines at the end ?

s = BluetoothServer(data_received)
pause()

see https://bluedot.readthedocs.io/en/latest/btcommapi.html

Your current script just sets the GPIO, defines a function but then exits.
by ghp
Sat Nov 27, 2021 11:39 pm
Forum: Automation, sensing and robotics
Topic: 12v heater for miniature green house?
Replies: 11
Views: 436

Re: 12v heater for miniature green house?

Which temperature do you need , better what is the delta T, temperature difference to ambient ? To estimate heating power needed, I did an experiment with a plastic box heated by a bulb and I calculated some values. - experiment with a small PE box, 320x270x140 mm, powered by a nominal 60W bulb (233...
by ghp
Tue Nov 23, 2021 9:01 am
Forum: Automation, sensing and robotics
Topic: RPI Twin Motor Control GUI
Replies: 2
Views: 128

Re: RPI Twin Motor Control GUI

tkinter is a library - well documented - which has all the basic control elements.
Example: https://www.tutorialspoint.com/python/tk_button.htm
by ghp
Sun Nov 21, 2021 10:57 am
Forum: Other projects
Topic: Is This Power bank Enough for the Zero 2 W? [SOLVED]
Replies: 8
Views: 346

Re: Is This Power bank Enough for the Zero 2 W?

addfile.png
addfile.png (14.49 KiB) Viewed 119 times
and then use 'place inline'
by ghp
Sun Nov 21, 2021 8:16 am
Forum: Other projects
Topic: Building temperature sensor network for greenhouse
Replies: 10
Views: 502

Re: Building temperature sensor network for greenhouse

Error correction
https://www.maximintegrated.com/en/desi ... 2/208.html

Although not easy for a hobbyist: need a stirred oil bath, a reference, calibrated sensor.
by ghp
Sat Nov 20, 2021 3:16 pm
Forum: Other projects
Topic: Is This Power bank Enough for the Zero 2 W? [SOLVED]
Replies: 8
Views: 346

Re: Is This Power bank Enough for the Zero 2 W?

20000mAh / 240mA ≈ 80h which is a very rough estimate. zero prox 200mA, gps module 36/28mA. Did some runtime estimations this summer for a small lipo, step up regulator to 5V and powering a pi zero from this. Important are the 'usual' power reduction methods - LED off - WIFI/BT off - HDMI off. Here ...
by ghp
Sat Nov 20, 2021 11:26 am
Forum: Automation, sensing and robotics
Topic: PMS5003: RuntimeError: Not running on a RPi!
Replies: 4
Views: 276

Re: PMS5003: RuntimeError: Not running on a RPi!

The hypothesis was that the RPi.GPIO is outdated. This is based on an analysis of the sources of RPi.GPIO, found in https://pypi.org/project/RPi.GPIO/#files The message is produced in file py_gpio.c ... } else if (result == SETUP_NOT_RPI_FAIL) { PyErr_SetString(PyExc_RuntimeError, "Not running ...
by ghp
Fri Nov 19, 2021 5:53 pm
Forum: Automation, sensing and robotics
Topic: PMS5003: RuntimeError: Not running on a RPi!
Replies: 4
Views: 276

Re: PMS5003: RuntimeError: Not running on a RPi!

The message you see "Not running on a RPi!" is produced by RPi.GPIO.
Could be you run an old version of RPi.GPIO.
Check Version with

Code: Select all

import RPi.GPIO as GPIO
print(GPIO.VERSION)
On a current OS you should see 0.7.0.

Could be you use a SD card flashed before the era of PI4 ?
by ghp
Fri Nov 19, 2021 7:42 am
Forum: Other projects
Topic: Building temperature sensor network for greenhouse
Replies: 10
Views: 502

Re: Building temperature sensor network for greenhouse

There are many approaches possible to build this sensor network. It also depends on the requirements for flexibility, maintainability, robustness and availability of time, skills and money. My proposal is to provide local sensor boxes. Each box contains a pico which has connection to 8 or more ds18b...
by ghp
Thu Nov 18, 2021 4:12 pm
Forum: Python
Topic: Threading Timer Problem in Crontab
Replies: 2
Views: 167

Re: Threading Timer Problem in Crontab

debugging is difficult while system is starting up. You could write messages to syslog (script started, callback_func is starting, exceptions while executing). There is https://docs.python.org/3/library/syslog.html available for this purpose. If it looks as if timer starts too early then possibly an...
by ghp
Thu Nov 18, 2021 6:42 am
Forum: Other projects
Topic: Earthquake tectonic plate simulation
Replies: 4
Views: 150

Re: Earthquake tectonic plate simulation

depends on what the purpose of your simulation is - demonstrate moving plates visually take some sheet of colored paper and produce a stop-motion video - small scale model to demonstrate movement for kids make a full mechanical model with a hand lever moving the plates. Kids can move plates, feel th...
by ghp
Mon Nov 15, 2021 7:35 pm
Forum: Other projects
Topic: How to add real time clock when headless Pi is using GPIO pins
Replies: 13
Views: 687

Re: How to add real time clock when headless Pi is using GPIO pins

There is a interesting approach in https://blog.blinkenlight.net/experiments/dcf77/ It covers DCF77, but should be possible to use this with WWVB too. The author uses signal analysis methods to recover phase from the signal and remove noise from the signals. But he admits that there are situations w...
by ghp
Sun Nov 14, 2021 12:03 pm
Forum: Other projects
Topic: Building temperature sensor network for greenhouse
Replies: 10
Views: 502

Re: Building temperature sensor network for greenhouse

DS18B20 temperature sensors can be used in 'network' configurations. https://www.maximintegrated.com/en/products/sensors/DS18B20.html See also https://www.maximintegrated.com/en/design/technical-documents/tutorials/1/148.html I would place a raspberry pico in the greenhouse, attach DS18B20 in a star...
by ghp
Sat Nov 13, 2021 1:06 pm
Forum: Python
Topic: Flask file upload
Replies: 3
Views: 203

Re: Flask file upload

Guess you have multiple problems: - nested form tags in html, see <h3>Unic; close this form tag. - misspelled property "filname": if file and allowed_file(file.filname) I'd propose to change - do not call upload_file as a method. use flask @app.route('/upload', methods=['POST']) <form meth...
by ghp
Sat Nov 13, 2021 11:48 am
Forum: Python
Topic: LibreOffice Calc spreadsheets Programmatically with Python.
Replies: 5
Views: 252

Re: LibreOffice Calc spreadsheets Programmatically with Python.

https://realpython.com/openpyxl-excel-s ... ts-python/

Works only with files in xlsx format (bot libreoffice can handle this).
by ghp
Sat Nov 13, 2021 8:18 am
Forum: Python
Topic: Viewing Python Service Output
Replies: 7
Views: 229

Re: Viewing Python Service Output

didn't want log files to build up
logging package provides rotating logs, see RotatingFileHandler which limits size.
by ghp
Fri Nov 12, 2021 10:16 am
Forum: Automation, sensing and robotics
Topic: Inconsistent behavior of PUD_UP using pigpio
Replies: 6
Views: 288

Re: Inconsistent behavior of PUD_UP using pigpio

So we worry about GPIO19 on header pin 35 ?
Verified on a pi4 here and the pin can be pulled up. Reads '1' and with an external connection to GND it reads '0'.
by ghp
Fri Nov 12, 2021 6:40 am
Forum: Python
Topic: Accessing internet using Ethetnet with a python code
Replies: 3
Views: 158

Re: Accessing internet using Ethetnet with a python code

The connection to a wired network does not need something like ssid or password. Just connect the wire (which is obviously a manual step) and in most networks the OS uses DHCP to get ip address and other details from the network.

The step 'net_connectivity' is same for wifi or wired networks.
by ghp
Thu Nov 11, 2021 9:44 pm
Forum: Automation, sensing and robotics
Topic: SCD30 measures temperature and humidity only
Replies: 1
Views: 135

Re: SCD30 measures temperature and humidity only

- You could try to again set periodic measurement: start_periodic_measurement
- You could check power supply. Found that my sensor stopped working if Vcc is close to 3.3V. Powered it with 5V and worked again.
by ghp
Thu Nov 11, 2021 9:25 pm
Forum: Python
Topic: Viewing Python Service Output
Replies: 7
Views: 229

Re: Viewing Python Service Output

look for python logging: https://docs.python.org/3/howto/logging.html
You can configure back ends to e.g. write into log-files or into the system logs.
by ghp
Wed Nov 10, 2021 4:59 pm
Forum: Automation, sensing and robotics
Topic: Inconsistent behavior of PUD_UP using pigpio
Replies: 6
Views: 288

Re: Inconsistent behavior of PUD_UP using pigpio

Have a look: https://pinout.xyz/#
There are GPIO used for 'alternative' function. Depends on the drivers active. See raspi-config also for the interfaces active.
by ghp
Tue Nov 09, 2021 6:25 pm
Forum: Python
Topic: Sensor -> Raspberry Pi -> Phyton
Replies: 2
Views: 157

Re: Sensor -> Raspberry Pi -> Phyton

by ghp
Fri Nov 05, 2021 11:39 am
Forum: Python
Topic: WaveShare 8x8 RGB LED Hat
Replies: 3
Views: 140

Re: WaveShare 8x8 RGB LED Hat

To repeatedly set colors, just repeat the loop: for i in range(strip.numPixels()): R = 255 # max values for R,G.B G = 255 B = 255 strip.setPixelColor(i, Color(R,G,B) ) To dim values, reduce the R,G,B values. (0,0,0) will be dark. for i in range(strip.numPixels()): R = 5 # glim the red led only G = 0...
by ghp
Thu Nov 04, 2021 7:46 pm
Forum: Python
Topic: WaveShare 8x8 RGB LED Hat
Replies: 3
Views: 140

Re: WaveShare 8x8 RGB LED Hat

The page https://www.waveshare.com/wiki/RGB_LED_HAT_(B)
has some explanation about the sample code.

Go to advanced search