Go to advanced search

by ghp
Sun Jun 21, 2015 11:04 am
Forum: Python
Topic: Strange errors
Replies: 9
Views: 990

Re: Strange errors

Hello, nice idea for a program. The variable nightmarealert is only defined in the if/else path, but not generally available. Place a default value upfront: nightmarealert = None if type == "F" or "f": print (fairy_story) elif type == "T" or "t": print (tt_story) elif type == "S" or "s": nightmareal...
by ghp
Sat Jun 20, 2015 9:03 pm
Forum: Python
Topic: python for mq-135 sensor
Replies: 5
Views: 5359

Re: python for mq-135 sensor

Hello,
this module obviously has a comparator 'on board', so not only the bare sensor.
Of course you can use digital output here; possibly you need a voltage divider to adjust the 5V-level to the 3.3V-Level.
Regards,
Gerhard
by ghp
Sat Jun 20, 2015 5:51 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Raspberry Pi and FS1000A transmitter
Replies: 1
Views: 1493

Re: Raspberry Pi and FS1000A transmitter

Hello, try using the serial output, GPIO14 on the UART. You need to disable serial output from the operating system (raspi-config provides menu to disable).
Then use pyserial. Do not put baud rate too fast for the beginning, 1200 bd and when this is stable then increase.

Regards,
Gerhard
by ghp
Sat Jun 20, 2015 5:31 pm
Forum: Python
Topic: Multithreading GPIO
Replies: 2
Views: 1018

Re: Multithreading GPIO

Hello, just use 'threading'. There are many tutorials on the net, e.g. http://pymotw.com/2/threading/ . Keep in mind that raspberry with python will have limits in pulse frequency generation. Steppers require high pulse rates when running even at moderate rotation rates. One rotation per second, 200...
by ghp
Sat Jun 20, 2015 1:50 pm
Forum: Python
Topic: Error: Microsoft Visual C++ 10.0 is required (vcvarsall.bat)
Replies: 2
Views: 1579

Re: Error: Microsoft Visual C++ 10.0 is required (vcvarsall.

Hello, you are doing strange things (sorry). Look at this solution of a small project I called gpio_substitute. It has a src-Folder, where a test.py and test2.py are. rpigpio.png There is also a RPi-Folder with a GPIO.py and an empty __init__file. The first test file is try: import RPi.GPIO as GPIO ...
by ghp
Sat Jun 20, 2015 6:09 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: GPIO pull down difference with RpI 2
Replies: 2
Views: 946

Re: GPIO pull down difference with RpI 2

Hello, this transistor has Ib=5mA, Ibe=0.9V at Ic=100mA. 100mA is max current continuous. And you have hfe of 200, this is @2mA Ic, but do not rely on this 200. I would place a series resistor between the GPIO and base connection transistor of (3.3-0.9) V/ 5mA which are the saturation values from th...
by ghp
Fri Jun 19, 2015 9:28 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: GPIO pin will not hold its output value
Replies: 5
Views: 5573

Re: GPIO pin will not hold its output value

Hello, how do you probe the output ? Are you sure that no other programs are running working with GPIO in the background ? And could you give more details on the relais board ? photo, schema, description. And last not least: The P1-13-pin has changed assignment between R1 and R2 of the Pi. If you ow...
by ghp
Fri Jun 19, 2015 7:32 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: pt100+max6675
Replies: 7
Views: 3063

Re: pt100+max6675

Hello, pt100 (from the headline) or pt1000 (from your text) are temperature variable resistors, about 100 or 1000 Ohms at 0 degree Celsius. The max6675 is designed for a type -K thermocouple. from wikipedia " Type K (chromel – alumel) is the most common general purpose thermocouple with a sensitivit...
by ghp
Fri Jun 19, 2015 4:20 pm
Forum: Python
Topic: Raspian CPU monitor?
Replies: 6
Views: 771

Re: Raspian CPU monitor?

Hello,

the entry is for 'python'. When no other process is using python, then it is tkinter.
Regards,
Gerhard
by ghp
Fri Jun 19, 2015 3:53 pm
Forum: Python
Topic: Inaccurate timing under load - give prio?
Replies: 16
Views: 2133

Re: Inaccurate timing under load - give prio?

Hello,

see http://heppg.de/ikg/wordpress/?p=408
Even in my 'not loaded' environment, the timing is not very accurate. My solution is to use an external slave microcontroller to solve this problem. Costs 4 or 5€ and saves a lot of headache.

Regards,
Gerhard
by ghp
Fri Jun 19, 2015 3:48 pm
Forum: Python
Topic: Raspian CPU monitor?
Replies: 6
Views: 771

Re: Raspian CPU monitor?

Hello,

in a console window, enter 'top'.
'top' is a monitor, which displays processes, cpu per process, memory and some more stuff.

Regards,
Gerhard
by ghp
Fri Jun 19, 2015 3:24 pm
Forum: Python
Topic: Arduino to Pi with python
Replies: 13
Views: 1241

Re: Arduino to Pi with python

Hello, with regular expressions, this is not a difficult task. a short sample is (not complete) import re data = [ "Humidity: 53.30 %", "Light Level 69 - Dark", "provided altitude: 69 meters, 226 feet", "temperature: 19.46 deg C, 67.03 deg F", "absolute pressure: 1015.54 mb, 29.99 inHg", "relative (...
by ghp
Wed Jun 17, 2015 3:24 am
Forum: Python
Topic: raspberry pi weather station multiple spins
Replies: 4
Views: 776

Re: raspberry pi weather station multiple spins

Hello, if I am right, this anemometer just provides a reed switch. Did you provide a pullup resistor in your setup, as needed to connect buttons/switches/reeds ? There is a nice tutorial in https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/buttons_and_switches/ You should have connected ...
by ghp
Mon Jun 15, 2015 8:38 pm
Forum: Python
Topic: Project teamwork with Python
Replies: 4
Views: 827

Re: Project teamwork with Python

Hello, git is a good choice, but svn is still quite popular. If you plan on a larger scale, you will need to have an own server somewhere on the web for your dev environment. If your project grows, you will need continuous integration (hudson) also. Possibly a ticketing system is needed, and of cour...
by ghp
Mon Jun 15, 2015 8:21 pm
Forum: Python
Topic: Very strange behavior (time.strftime() kills main thread ??)
Replies: 30
Views: 3253

Re: Very strange behavior (time.strftime() kills main thread

Good news, it is a slow problem. And obviously each of the pins is handled the same way independent of the other pins. I usually try to handle problems like these with state machines. For your problem, the inputs are [0] or [1] and possibly you need some time events. For the pure academic implementa...
by ghp
Mon Jun 15, 2015 6:00 pm
Forum: Python
Topic: Very strange behavior (time.strftime() kills main thread ??)
Replies: 30
Views: 3253

Re: Very strange behavior (time.strftime() kills main thread

Hello, before making an architecture, some more details needed on timing and number of events per second. Are input signals in second (or more) or in millisecond range ? And how many of these will come in average per second (a few or hundreds) ? Are the signals 'clean' or need debouncing ? If there ...
by ghp
Mon Jun 15, 2015 3:41 pm
Forum: Python
Topic: SPIDEV code problem
Replies: 12
Views: 1967

Re: code

Hello,

welcome in the python forum !
Most possibly you need to enable the spi driver. This is best done using
sudo raspi-config
Look into '8, advanced', 'A6, SPI' and enable this. Could be you need to reboot then.

Regards,
Gerhard
by ghp
Sun Jun 14, 2015 8:02 pm
Forum: Python
Topic: Correct way to download and install modules into Python?
Replies: 17
Views: 10495

Re: Correct way to download and install modules into Python?

Hello, see http://dev.mysql.com/doc/connector-pyth ... mples.html
This is what I used some year ago to connect to a mysql database.

Hope this helps
Gerhard
by ghp
Sun Jun 14, 2015 11:44 am
Forum: Python
Topic: Very strange behavior (time.strftime() kills main thread ??)
Replies: 30
Views: 3253

Re: Very strange behavior (time.strftime() kills main thread

Hello, I was curious to see what happens in this code. Programmed an external pulse generator (100ms high in 500ms period) with an arduino due and ran your code. With python3, the code behaves the same as you report. Different behavior in python2. This is strange. In general, your code is imho not a...
by ghp
Sat Jun 13, 2015 6:07 am
Forum: Python
Topic: need help... Placing a function outcome into a mysql entry.
Replies: 11
Views: 1338

Re: need help... Placing a function outcome into a mysql ent

Hello, you should consider to add a 'universal database administration tool' to your toolbox. Handy to look into data, execute some statements without the need to write code for each and any sql. There are lots of them around, see https://en.wikipedia.org/wiki/Comparison_of_database_tools My favorit...
by ghp
Fri Jun 12, 2015 9:52 pm
Forum: Python
Topic: Newbie to Raspberry Pi 2 and Python needs your advice
Replies: 10
Views: 1107

Re: Newbie to Raspberry Pi 2 and Python needs your advice

Hello, some time ago I did some investigation on how precise it is to measure short pulses of 10ms with python and compared this with a microcontroller. Most probably, these results can be interpreted 'the other way round' to estimate accuracy of pulse generation. See chart in http://heppg.de/ikg/wo...
by ghp
Fri Jun 12, 2015 8:48 pm
Forum: Python
Topic: Newbie to Raspberry Pi 2 and Python needs your advice
Replies: 10
Views: 1107

Re: Newbie to Raspberry Pi 2 and Python needs your advice

Hello, will you control servo (pwm, 20ms cycle, pwm controlled) or solenoids with your machine ? What about 7*24 h operation ? From time to time you will loose power... And there is need for maintenance, updating os which is cpu intensive. My first ideas have been to control the hardware by an ardui...
by ghp
Wed Jun 10, 2015 2:42 am
Forum: Python
Topic: Please recommend a good tutorial/book
Replies: 3
Views: 512

Re: NOOB

the noob-to-nerd-page is (drum fill) http://www.python-course.eu/lambda.php
by ghp
Tue Jun 09, 2015 5:08 am
Forum: Python
Topic: Problems with File input/output
Replies: 2
Views: 421

Re: Problems with File input/output

Hello, could be that your file is empty or not to be allowed to be read? Try out: - stop all code, and inspect the file. 'cat TheGameData.txt' should show the content. - If no data are in the file, take a text editor (leafpad, vi, whatever you use) and write some lines of text into this file. permis...
by ghp
Mon Jun 08, 2015 9:13 pm
Forum: Python
Topic: reading from a socket in python
Replies: 8
Views: 3045

Re: reading from a socket in python

Sockets do not have a record structure, it is a simple sequence of bytes. Even if you send something like packets, the read operation can give you single bytes up to byte sequences from consequtive send operations. So make the data readable (ascii encoded), which is generally a good idea when you co...

Go to advanced search