Go to advanced search

by ghp
Tue Apr 23, 2019 6:49 pm
Forum: Python
Topic: Replicating an existing keypad interface
Replies: 1
Views: 44

Re: Replicating an existing keypad interface

Hello, so what I understand is that you want to leave the PIC in place and just to 'simulate' the signals. One possibility would be to use 3 rows * 4 columns = 12 analog switches to emulate the old switches. Then the pi could control the switch control lines and this is an easy thing as timing is no...
by ghp
Tue Apr 23, 2019 6:27 pm
Forum: Python
Topic: Use RPi.GPIO Library on Eclipse (mac)
Replies: 2
Views: 47

Re: Use RPi.GPIO Library on Eclipse (mac)

Hello, welcome to the world of cross-deleveopment. Depending on what you want to achieve, there are different strategies: (A) develop on computer, transfer to pi and test on pi. Run on pi. (B) develop on computer, test on computer using mockup, transfer to pi and test on pi. Run on pi. (C) develop o...
by ghp
Tue Apr 23, 2019 5:03 pm
Forum: Python
Topic: Controlling LED strip from GPIO Help?
Replies: 4
Views: 84

Re: Controlling LED strip from GPIO Help?

Timing for these ws2811 is very strict and is difficult to achieve on a linux system. I propose to use an arduino board as LED controller and to transmit the led brightness data by serial connection.
by ghp
Tue Apr 23, 2019 10:13 am
Forum: Python
Topic: Threading serial read in python GUI
Replies: 15
Views: 278

Re: Threading serial read in python GUI

import tkinter import time import threading import random import queue import sys class GuiPart: def __init__(self, master, queue, endCommand): self.queue = queue # Set up the GUI console = tkinter.Button(master, text='Done', command=endCommand) self.v = tkinter.StringVar() self.v.set( "abcde") lab...
by ghp
Fri Apr 19, 2019 1:52 pm
Forum: Python
Topic: Connecting and recording data from a UGEEK Multiple Sensors Cobber v0.2
Replies: 6
Views: 121

Re: Connecting and recording data from a UGEEK Multiple Sensors Cobber v0.2

Hello,
the barometric formula is explained in many places, e.g. https://www.math24.net/barometric-formula/
Take this as a chance to learn interesting things about math and physics.
by ghp
Fri Apr 19, 2019 7:50 am
Forum: Python
Topic: No SPI Clock
Replies: 3
Views: 79

Re: No SPI Clock

Hello, you open the device two times, but think the reason of the problem is related to transferring bytes. Try using lists:

Code: Select all

    dataout = 0x5a
    spi.xfer2( list(dataout) )
or spi.xfer2( [dataout] )
by ghp
Thu Apr 18, 2019 8:24 pm
Forum: Python
Topic: python farm managing
Replies: 2
Views: 77

Re: python farm managing

Hello, difficult to see what your code is intended to do. What I can't see is how temp or humidity measurements are acquired. What did you already do to understand/ correct the problem ? What is the detailed behavior at the time of failure ? (logging, error messages, network problems, or alike) Syst...
by ghp
Thu Apr 18, 2019 9:02 am
Forum: Python
Topic: Connecting and recording data from a UGEEK Multiple Sensors Cobber v0.2
Replies: 6
Views: 121

Re: Connecting and recording data from a UGEEK Multiple Sensors Cobber v0.2

Hello, the published weather data contain air pressure referred to sea level. openweatermap has an API which allows to query weather data, including pressure. This could provide you with a reference pressure and is easier to achieve compared to the effort of drilling a hole to sea level and establis...
by ghp
Wed Apr 17, 2019 8:33 pm
Forum: Python
Topic: Servo on Adafruit 16-channel PWM/Servo HAT ZeroDivisionError: float division by zero
Replies: 1
Views: 56

Re: Servo on Adafruit 16-channel PWM/Servo HAT ZeroDivisionError: float division by zero

Some code analysis: There is a property 'frequency' in the underlying PCA9685 class. When frequency is set, the value prescale_reg is set.

Looks as if this mechanism is not working. Do you run it with python 2 or python3 ? If python2, then try python3.
by ghp
Tue Apr 16, 2019 7:45 pm
Forum: Python
Topic: Store gy-neo6mv2 gps module data into mysql
Replies: 5
Views: 127

Re: Store gy-neo6mv2 gps module data into mysql

There are some reports in the net around 2014 about "Experimental MySQL HTTP API", which allows to use a REST API with mysql.
Do not know whether this is still in current release. I am curious to see your report on how to use it, security and performance.
by ghp
Sun Apr 14, 2019 3:44 pm
Forum: Python
Topic: Threading
Replies: 2
Views: 99

Re: Threading

When running code here, I get (Thread-1 ) Sleeping 0.85 (Thread-2 ) Sleeping 0.96 (MainThread) Waiting for worker threads (Thread-1 ) Waiting for lock (Thread-1 ) Acquired lock (Thread-1 ) Releasing (Thread-1 ) Sleeping 0.88 (Thread-2 ) Waiting for lock (Thread-2 ) Acquired lock (Thread-2 ) Releasin...
by ghp
Sat Apr 13, 2019 9:10 pm
Forum: Python
Topic: Python recursion error
Replies: 10
Views: 279

Re: Python recursion error

Had a look to your code. What I understand is that you have six temp/moisture sensors, six pumps switched by a relais board. The waterlevel sensor is not used ? Writing the code object oriented would be a good approach. Something like: class Waterer: START = 0 PUMP = 1 SEEP = 2 def __init__(self, pu...
by ghp
Sat Apr 13, 2019 5:03 pm
Forum: Python
Topic: Python recursion error
Replies: 10
Views: 279

Re: Python recursion error

Perhaps you want to have a look to "The State Machine Compiler" on http://smc.sourceforge.net/.
There are a lot of examples and howto on this site.
Even if you do not want to add generated code to your app, the examples are a good entry point to understand state machines.
by ghp
Sat Apr 13, 2019 4:53 pm
Forum: Python
Topic: can you switch X and z and Z and x
Replies: 4
Views: 143

Re: can you switch X and z and Z and x

You can implement a wrapper around 'mc' doing the switch job. Something like a "Man in the Middle" Let me name the wrapper 'SwitchCoordinates' class SwitchCoordinates: def __init__(self, mc_): self.mc_ = mc_ def getBlock(self, x,y, z): return self.mc_.getBlock(x,y,z) def setBlocks(self, x0,y0,z0, x1...
by ghp
Thu Apr 11, 2019 8:38 pm
Forum: Python
Topic: Real time ECG filtering
Replies: 4
Views: 181

Re: Real time ECG filtering

Hello, asking google for ecg filtering brings up more than 3 million entries. I did not read everything, but basically you will need a band pass filter (low pass and high pass filter combined) for an effective band of prox 0.05Hz to 150Hz. It could be a good idea to add an analog low pass filter bet...
by ghp
Sat Mar 30, 2019 6:52 pm
Forum: Python
Topic: Sqlite3 DELETE
Replies: 22
Views: 398

Re: Sqlite3 DELETE

Hello, I have used vacuum in a database where there have been 100GB and more data. A sample with prox 27 MB size: #!/usr/bin/python3 import os import sqlite3 import time dbname = "mydb_10.sqlite" if os.path.exists(dbname): os.remove( dbname) db = sqlite3.connect(dbname) cursor = db.cursor() cursor.e...
by ghp
Sat Mar 30, 2019 5:10 pm
Forum: Python
Topic: Sqlite3 DELETE
Replies: 22
Views: 398

Re: Sqlite3 DELETE

Perhaps it needs to be clarified what the intended behavior of the application is. When a database deletes a row, the data are lost (ok, still there on some files in disk for some time, possibly somewhere in a backup, but not available easily with sql statements). Depending on how the database is wo...
by ghp
Sat Mar 30, 2019 9:26 am
Forum: Python
Topic: Sqlite3 DELETE
Replies: 22
Views: 398

Re: Sqlite3 DELETE

Hello, a few comments. - Pragma vacuum is needed to reduce file size. It allows the sqlite to free deleted entries from the file. It does not affect the way how sqlite handles primary keys. Scenario: assume to insert zillions of records, delete most of them and database size does not shrink. With va...
by ghp
Fri Mar 29, 2019 7:57 pm
Forum: Python
Topic: Reliably read sensor data
Replies: 4
Views: 183

Re: Reliably read sensor data

It could help to know the type of sensor and then also where to find a datasheet. What I think is strange is the size of the data package: '1268 byte' for a 'single pixel ... sensor'. Many sensors with long data packages have some message frame including checksum which allows to find out if somethin...
by ghp
Wed Mar 27, 2019 9:12 pm
Forum: Python
Topic: Systemd service for python script not writing to file
Replies: 10
Views: 312

Re: Systemd service for python script not writing to file

Agree with PhatFil: do not open same file in the python app "open(/home/pi/senselog.csv)" AND at the same time write to this file with a redirect of stdout ( >> /home/pi/senselog.csv). Might result in strange results. When you use redirect, den use print()-statements in the python app which will be ...
by ghp
Sun Mar 24, 2019 11:04 am
Forum: Python
Topic: How to copy MySQL table into Python variables
Replies: 1
Views: 92

Re: How to copy MySQL table into Python variables

Reading data from mysql is explained in many places, e.g. in https://www.w3schools.com/python/python_mysql_select.asp An example is mycursor = mydb.cursor() sql = "select A,B from table_AB" mycursor.execute(sql) myresult = mycursor.fetchall() print ("myresult", myresult) The printout shows: myresult...
by ghp
Sat Mar 23, 2019 5:18 pm
Forum: Python
Topic: Solved: How to avoid that math problem?
Replies: 11
Views: 327

Re: How to avoid that math problem?

But if I modify dB = (ret[0] + ((ret[1] & 3) * 256)) * 0.1 + 30 to dB =decimal( (ret[0] + ((ret[1] & 3) * 256)) * 0.1 + 30) I get an error: Traceback (most recent call last): File "devdB.py", line 35, in <module> update() File "devdB.py", line 26, in update dB = decimal((ret[0] + ((ret[1] & 3) * 25...
by ghp
Sat Mar 23, 2019 1:58 pm
Forum: Python
Topic: RPi Tempmon
Replies: 10
Views: 234

Re: RPi Tempmon

In the webpage you reference, there is an extensive documentation.
What did you try so far, which problems did you find ?

Go to advanced search