Go to advanced search

by OldPCGuy
Sun Apr 23, 2017 3:38 pm
Forum: General discussion
Topic: Good Low Cost RTC
Replies: 22
Views: 4651

Re: Good Low Cost RTC

This is a good article on making the cheap RTCs found on eBay reliable. https://www.google.com/amp/s/edwardmallon.wordpress.com/2014/05/21/using-a-cheap-3-ds3231-rtc-at24c32-eeprom-from-ebay/amp/ I have on order the same/clone module noted in the article. Are the empty/open data pins on the opposit...
by OldPCGuy
Sun Apr 23, 2017 2:48 pm
Forum: Python
Topic: Is this ShutDown Code Safe
Replies: 9
Views: 989

Re: Is this ShutDown Code Safe

topguy wrote:You could run the "sync" command. It should flush all filebuffers.
https://linux.die.net/man/8/sync
So I would sync/syncfs then f.close() or vice versa?
by OldPCGuy
Mon Apr 03, 2017 12:15 am
Forum: Python
Topic: Is this ShutDown Code Safe
Replies: 9
Views: 989

Is this ShutDown Code Safe

I'm using the following statement with a push button to close a log file and shut down a Pi Zero. os.system('systemctl poweroff') # shut down the pi In the blink of an eye the GUI disappeared and a bunch of lines wrote to the command line ending with the shutdown line. It scared me how fast it shutd...
by OldPCGuy
Mon Apr 03, 2017 12:05 am
Forum: Python
Topic: pigpio Shutdown Button Help
Replies: 3
Views: 546

Re: pigpio Shutdown Button Help

paddyg wrote:I would have thought you could just swap the gpio part of the code, have you tried that?
Yes that what I finally figured out and did. It took me some time to get the PIGPIO syntax correct. :roll:
by OldPCGuy
Sat Apr 01, 2017 3:59 pm
Forum: Python
Topic: pigpio Shutdown Button Help
Replies: 3
Views: 546

pigpio Shutdown Button Help

All the shutdown button examples seem to use the standard RPi.GPIO library. I'm looking for one that uses the "pigpio" library. I want to push a button; de-bounce; close an open file; shutdown the pi. My code currently launches @boot from crontab. Is there a pigpio equivalent to the RPi examples I'v...
by OldPCGuy
Mon Mar 27, 2017 11:47 pm
Forum: Python
Topic: Script Will Not Run Under CRON
Replies: 28
Views: 2547

Re: Script Will Not Run Under CRON

so assuming you want the file created in /home/pi try changing it to this and see if it will work. with open('/home/pi/TempHumid5_' + datestring + '.csv', "a") as f: all I have done is add the directory path this is what normally causes a lot of scripts not to function when run using cron because a...
by OldPCGuy
Mon Mar 27, 2017 11:06 pm
Forum: Python
Topic: Script Will Not Run Under CRON
Replies: 28
Views: 2547

Re: Script Will Not Run Under CRON

Sorry should have added the code earlier. #!/usr/bin/python import time import pigpio import PIGPIO.DHT22 as DHT22 # loads PIGPI code from sub directory sets alias import csv from datetime import datetime, date time.sleep(20) # pause running untill all system are up and running # not sure this works...
by OldPCGuy
Mon Mar 27, 2017 3:51 pm
Forum: Python
Topic: Script Will Not Run Under CRON
Replies: 28
Views: 2547

Re: Script Will Not Run Under CRON

Hello, perhaps the ampersand '&' after the command is the problem ? background processes are difficult to analyze. Adding syslog entries to your code will help to find the problem. Tried with and without &, no luck. I added the logging code to my script. The syslog file I found was not updated, the...
by OldPCGuy
Mon Mar 27, 2017 3:46 pm
Forum: Python
Topic: Script Will Not Run Under CRON
Replies: 28
Views: 2547

Re: Script Will Not Run Under CRON

On arch they are in /var/spool/cron but I just checked and R. jessie lite puts them in /var/spool/cron/crontabs . You are not supposed to directly edit those files, however. This link has some information: http://unix.stackexchange.com/questions/196009/location-of-the-crontab-file I only wanted to ...
by OldPCGuy
Mon Mar 27, 2017 12:09 am
Forum: Python
Topic: Script Will Not Run Under CRON
Replies: 28
Views: 2547

Re: Script Will Not Run Under CRON

You may wish to do a test and run something that saves the root crontab environment to a file so you can look at it. The other posters are likely right that it isn't finding the python executable. I can't find the crontab file that I edited under sudo crontab -e. I've seach all folders and hidden f...
by OldPCGuy
Sun Mar 26, 2017 10:05 pm
Forum: Python
Topic: Script Will Not Run Under CRON
Replies: 28
Views: 2547

Re: Script Will Not Run Under CRON

DirkS wrote:Try using the full path to the python executable.
when you say executable that refers to the python script; in my case MyDHT22.py?
by OldPCGuy
Sun Mar 26, 2017 8:01 pm
Forum: Python
Topic: Script Will Not Run Under CRON
Replies: 28
Views: 2547

Script Will Not Run Under CRON

I've added the following lines using sudo crontab -e @reboot /usr/bin/pigpiod @reboot python /home/pi/MyDHT22.py & The python script will not automatically start @boot. I can manually run the script from the command line, so I know the pigpiod demon is running and the python code is fine. My Pi boot...
by OldPCGuy
Sun Mar 26, 2017 6:24 pm
Forum: Beginners
Topic: Should I Disable Wireless on Pi Zeroo
Replies: 4
Views: 521

Re: Should I Disable Wireless on Pi Zeroo

Which flavour of PiZero? The whole point of the $10 PiZW is that it has network connectivity with no additional hardware needed. Disabling it would seem like you'd wasted that extra $5. Also those sorts of teeny, tiny network overheads don't count for much in the grand CPU usage battle. The biggest...
by OldPCGuy
Sun Mar 26, 2017 3:56 pm
Forum: Beginners
Topic: Should I Disable Wireless on Pi Zeroo
Replies: 4
Views: 521

Should I Disable Wireless on Pi Zeroo

I setup a SD card and OS for developing Python code on in my Pi3. That way I can easily search for help and tips on the internet. Ultimately this SD/OS/Python code will run a Pi Zero. I want to reduce processor overhead as much as possible, I notice the Zero hits 100% CPU usage frequently. Do I need...
by OldPCGuy
Sun Mar 19, 2017 8:44 pm
Forum: Automation, sensing and robotics
Topic: DHT_22 Pi Zero Issue
Replies: 2
Views: 623

Re: DHT_22 Pi Zero Issue

Well I solved my problem sort of?? I had to switch/use the PIGPIO library and pigpio demon @boot.

I could not get the Adafruit_DHT22 libray to work on the Pi Zero. Too bad the "retry" feature was nice. I guess I'll have to write my own for PGPIO. :|
by OldPCGuy
Sun Mar 19, 2017 2:55 pm
Forum: Automation, sensing and robotics
Topic: DHT_22 Pi Zero Issue
Replies: 2
Views: 623

Re: DHT_22 Pi Zero Issue

I built and programmed the simple LED blink tutorial so I'm fairly confident the Pi zero GPIO is functioning correctly. Is the DHT_22 code from AdaFruit processor specific? The fault message "platform" object and the "armv7l" has me wondering. File "/usr/local/lib/python3.4/dist-packages/Adafruit_DH...
by OldPCGuy
Sun Mar 19, 2017 1:18 am
Forum: Automation, sensing and robotics
Topic: DHT_22 Pi Zero Issue
Replies: 2
Views: 623

DHT_22 Pi Zero Issue

I setup a SD card with a Raspbian image; loaded the DHT_22 Adafruit files; and updated everything. Booting my Pi3 on this card I can read the DHT_22 (AM2302) just fine. When I boot my Pi Zero with the same card and run the same python script I get the following errors; Traceback (most recent call la...
by OldPCGuy
Mon Mar 13, 2017 4:43 pm
Forum: Python
Topic: Python 3 and DHT_22
Replies: 4
Views: 735

Re: Python 3 and DHT_22

I'm just learning Python and only have a couple small programs.

With v3 is there any reason to use v2?
by OldPCGuy
Sun Mar 12, 2017 10:31 pm
Forum: Python
Topic: Python 3 and DHT_22
Replies: 4
Views: 735

Python 3 and DHT_22

I have some Python v2 code running AM2302 (DHT_22) sensors. Trying to run with v3 it doesn't recognize

Code: Select all

import Adafruit_DHT
Is there something extra to do to run under v3 or is the Adafruit DHT_22 libraries not v3 compatible?
by OldPCGuy
Sun Mar 12, 2017 2:57 pm
Forum: Python
Topic: CSV File Open Scope
Replies: 3
Views: 747

Re: CSV File Open Scope

with open("TempHumid5.csv", "a") as f: wr = csv.writer(f, dialect='excel') Read_1() The file f is only open within the with block, as soon as you leave it the file gets closed. In your code the call to Read_1() is outside the with block and so the file has been closed by then. That was it Thx! How ...
by OldPCGuy
Sat Mar 11, 2017 9:11 pm
Forum: Python
Topic: CSV File Open Scope
Replies: 3
Views: 747

CSV File Open Scope

I'm testing 5 AM2302 temperature humidity sensors and writing the results to a csv file. After the first sensor read I'm getting an error that the file is closed. I'm new to Python so I'm struggling to figure out the csv.writer scope. I'm trying to avoid opening and closing the file after every sens...
by OldPCGuy
Fri Mar 10, 2017 12:46 am
Forum: General discussion
Topic: Good Low Cost RTC
Replies: 22
Views: 4651

Re: Good Low Cost RTC

I'm looking for a couple of low cost, reliable RTC modules for a Pi Zero. I see a bunch on EBay for 99 cents to $1.50 USD. I'm using ones like this http://www.ebay.com/itm/DS3231-Precision-RTC-Real-Time-Clock-Memory-Module-Modul-For-Raspberry-Pi-DIY-/152244927302 in several of my Pis and it works. ...
by OldPCGuy
Wed Mar 08, 2017 11:31 pm
Forum: General discussion
Topic: Good Low Cost RTC
Replies: 22
Views: 4651

Good Low Cost RTC

I'm looking for a couple of low cost, reliable RTC modules for a Pi Zero. I see a bunch on EBay for 99 cents to $1.50 USD.

I'm not looking for atomic precision; I'm recording trends sampling every 30-60 sec.

Are those EBay specials any good?
by OldPCGuy
Sun Mar 05, 2017 2:26 pm
Forum: Beginners
Topic: SD Card - Max Write Operstions
Replies: 2
Views: 468

SD Card - Max Write Operstions

Do I need to be concerned with how many write operations I perform to the SD card? The same one holding the OS. I have some temp/humidity logger code and hardware up and running. Next step is to save the data to a csv file on the SD card. I thought about storing X measures in memory then writing/app...
by OldPCGuy
Wed Mar 01, 2017 12:24 am
Forum: Automation, sensing and robotics
Topic: DHT22 Sensor Question
Replies: 1
Views: 374

DHT22 Sensor Question

I bought these PCB mounted DHT22 sensors they did not come with any instructions. https://www.newegg.com/Product/Product.aspx?Item=9SIABKS53H9014&nm_mc=TEMC-RMA-Approvel&cm_mmc=TEMC-RMA-Approvel-_-Content-_-text-_- The pcb has what looks like surface mount resistors and capacitors . Am I safe to ass...

Go to advanced search