Weblog Tomasza Przechlewskiego [Zdjęcie T. Przechlewskiego]


scrum
random image [Photo gallery]
Zestawienie tagów
1-wire | 18b20 | 1wire | 2140 | 3rz | adamowicz | afera | alsamixer | amazon | amber | amman | anniversary | antypis | apache | api | applebaum | arm | armenia | astronomy | asus | atom.xml | awk | aws | bachotek | bakłażan | balcerowicz | balta | banan | bash | batumi | berlin | białowieża | białystok | bibtex | bieszczady | birzeit | biznes | blogger | blogging | blosxom | bme280 | bono | borne-sulinowo | breugel | bt747 | budapeszt | budyniowo | budyń | bursztyn | campagnolo | canon | cedewu | chaos | chello | chiller | chillerpl | chown | christophe dominici | chujowetaśmy | ciasto | cmentarz | contour | coronavirus | covi19 | covid | covid19 | cron | css | csv | cukinia | curl | cycling | d54250wykh | darkages | dbi | debian | dejavu | dhcp | dht22 | dia | docbook | dom | dp1500 | ds18b20 | duda | dulkiewicz | dulkiewiczowa | dyndns | dynia | ebay | economy | ecowitt | ekonomia | elka | elm | emacs | emacs23 | english | ep | erasmus | erasmusplus | ess | eu | eurostat | excel | exif | exiftool | f11 | fc | fc11 | fc15 | fc29 | fc5 | fc8 | fedora | fedora21 | fenix | ffmpeg | finepix | firefox | flickr | folau | fontforge | fontspec | fonty | food | fop | forms | foto | france | francja | fripp | froggit | fuczki | fuji | fuse | gammu | garden | garmin | gas | gawk | gazwyb | gdańsk | gdynia | gender | geo | geocoding | georgia | gft | ggplot | ghost | git | github | gmail | gmaps | gnokii | gnus | google | google apps script | googlecl | googleearth | googlemaps | gotowanie | gphoto | gphoto2 | gps | gpsbabel | gpsphoto | gpx | gpx-viewer | greasemonkey | gruzja | grzyby | gus | gw1000 | haldaemon | handbrake | helsinki | hhi | historia | history | hitler | holocaust | holokaust | hp1000se | hpmini | humour | iblue747 | ical | iiyama | ikea | imagemagick | imap | inkscape | inne | internet | j10i2 | javascript | jhead | jifna | jordania | k800i | kajak | kamera | karob | kibbeh | kleinertest | kml | kmobiletools | knuth | kociewie kołem | kod | kolibki | komorowski | konwersja | krutynia | krynki | kuchnia | kurski | kłamstwo | latex | latex2rtf | latex3 | lcd | legend | lenny | lesund | lewactwo | lgbt-folly | liban | liberation | linksys | linux | lisp | lisrel | litwa | lizbona | logika | ltr | lubowla | lwp | lwów | m2wś | malta | mapquest | mapsource | maradona | marchew | marimekko | marvell | math | mathjax | mazury | mbank | mediolan | mencoder | mevo | mex | mh17 | michalak | michlmayr | microsoft | monitor | mp4box | mplayer | ms | msc | mssql | msw | mswindows | mtkbabel | museum | muzyka | mymaps | mysql | mz | nafisa | nanopi | natbib | navin | neapol | nekrolog | neo | neopi | netbook | niemcy | niemieckie zbrodnie | nikon | nmea | nowazelandia | nuc | nxml | oauth | oauth2 | obituary | ocr | odessa | okular | olympus | ooffice | ooxml | opera | osm | otf | otftotfm | other | ov5647 | overclocking | ozbekiston | padwa | palestyna | panoramio | paryż | pdf | pdfpages | pdftex | pdftk | pedophilia | perl | photo | photography | pi | picasa | picasaweb | pim | pine | pis | pit | pizero | plain | plotly | pls | plugin | po | podcast | podlasie | podróże | pogoda | politics | polityka | polsat | portugalia | postęp | powerpoint | połtawa | prelink | problem | propaganda | pseudointeligencja | pstoedit | putin | python | pywws | r | r1984 | radio | random | raspberry | raspberry pi | raspberrypi | raspbian | refugees | relaxng | ridley | router | rower | rowery | roztocze | rpi | rsync | rtf | ruby | rugby | rumunia | russia | rwc | rwc2007 | rwc2011 | rwc2019 | ryga | rzym | salerno | samba | sds011 | selenium | sem | senah | sernik | sheevaplug | sienkiewicz | signature | sikorski | sks | skype | skytraq | smoleńsk | sqlite | srtm | sshfs | ssl | staszek wawrykiewicz | statistcs | statistics | stats | statystyka | stix | stretch | supraśl | suwałki | svg | svn | swanetia | swornegacie | szwajcaria | słowacja | tallin | tbilisi | terrorism | tesseract | tex | texgyre | texlive | thunderbird | tomato | totalnaopozycja | tourism | tramp | trang | transylwania | truetype | trzaskowski | ttf | turcja | turkey | turystyka | tusk | tv | tv5monde | tweepy | twitter | tykocin | typetools | ubuntu | uchodźcy | udev | ue | ukraina | umap | unix | upc | updmap | ups | utf8 | uzbekistan | varia | video | vienna | virb edit | virbedit | vostro | wammu | wdc | wdfs | weather | weathercloud | webcam | webdav | webscrapping | weewx | wenecja | wh2080 | wiedeń | wikicommons | wilno | win10 | windows | windows8 | wine | wioślarstwo | wojna | word | wordpress | wrt54gl | ws1080 | wtyczka | wunderground | ww2 | www | wybory | wybory2015 | włochy | węgry | xemex | xetex | xft | xhtml | xine | xml | xmllint | xsd | xslt | xvidtune | youtube | yum | zaatar | zakopane | zakupy | zawodzie | zdf | zdrowie | zeropi | zgarden | zgony | zprojekt | łeba | łotwa | świdnica | żywność
Archiwum
06/2023 | 02/2023 | 01/2023 | 11/2022 | 10/2022 | 09/2022 | 07/2022 | 06/2022 | 04/2022 | 03/2022 | 02/2022 | 12/2021 | 09/2021 | 03/2021 | 01/2021 | 12/2020 | 11/2020 | 10/2020 | 09/2020 | 08/2020 | 07/2020 | 04/2020 | 03/2020 | 02/2020 | 01/2020 | 12/2019 | 11/2019 | 10/2019 | 09/2019 | 08/2019 | 07/2019 | 06/2019 | 04/2019 | 02/2019 | 01/2019 | 12/2018 | 11/2018 | 10/2018 | 09/2018 | 08/2018 | 07/2018 | 05/2018 | 04/2018 | 03/2018 | 02/2018 | 01/2018 | 11/2017 | 10/2017 | 09/2017 | 08/2017 | 07/2017 | 06/2017 | 05/2017 | 04/2017 | 03/2017 | 02/2017 | 01/2017 | 12/2016 | 11/2016 | 10/2016 | 09/2016 | 08/2016 | 06/2016 | 05/2016 | 04/2016 | 02/2016 | 12/2015 | 11/2015 | 09/2015 | 07/2015 | 06/2015 | 05/2015 | 02/2015 | 01/2015 | 12/2014 | 09/2014 | 07/2014 | 06/2014 | 04/2014 | 02/2014 | 01/2014 | 12/2013 | 11/2013 | 10/2013 | 09/2013 | 08/2013 | 07/2013 | 05/2013 | 04/2013 | 03/2013 | 02/2013 | 01/2013 | 12/2012 | 11/2012 | 10/2012 | 09/2012 | 08/2012 | 07/2012 | 05/2012 | 03/2012 | 02/2012 | 01/2012 | 12/2011 | 11/2011 | 10/2011 | 09/2011 | 08/2011 | 07/2011 | 06/2011 | 05/2011 | 04/2011 | 03/2011 | 02/2011 | 01/2011 | 12/2010 | 11/2010 | 10/2010 | 09/2010 | 08/2010 | 07/2010 | 06/2010 | 05/2010 | 04/2010 | 03/2010 | 02/2010 | 01/2010 | 12/2009 | 11/2009 | 10/2009 | 09/2009 | 08/2009 | 07/2009 | 06/2009 | 05/2009 | 04/2009 | 03/2009 | 02/2009 | 01/2009 | 12/2008 | 11/2008 | 10/2008 | 09/2008 | 08/2008 | 07/2008 | 06/2008 | 05/2008 | 04/2008 | 03/2008 | 02/2008 | 01/2008 | 12/2007 | 11/2007 | 10/2007 | 09/2007 | 08/2007 | 07/2007 |
O stronie
wykorzystywany jest blosxom plus następujące wtyczki: tagging, flatarchives, rss10, lastbuilddatexhtmlmime. Niektóre musiałem dopasować nieco do swoich potrzeb. Więcej o blosxom jest tutaj
Subskrypcja
RSS 1.0
Refined bash script to periodically run fswebcam

The script: 1) suspend capturing images at night for obvious reason and 2) writes images to files named as: image_<odd-or-even-week><day-of-week>_<hour><minute>.jpg

Thus only images from the last two weeks are stored and the older ones are deleted ``automatically''.

#!/bin/bash
OUTPUT_DIR=/var/www/cam/fswebcam-output
# Max resolution for C270 webcam is 1280x720
RESOLUTION="1280x720"
QUALITY="85"

MINUTE=`date +%M`
HOUR=`date +%H`
MONTH=`date +%m`
DAY_OF_WEEK=`date +%u`
WEEK=`date +%U`
FILE_OUT=`date +%d%H%M`
TODAY=`date +%Y/%m/%d`

## Suspend capturing pictures at night
DAY_START=`sun_calc.py -date "$TODAY" -city Sopot -param dawn`
DAY_STOP=`sun_calc.py -date "$TODAY" -city Sopot -param dusk`

if [ "$DAY_START" = "False" -o "$DAY_STOP" = "True" ] ; then
     NIGHT="YES"; exit;
fi

fswebcam -r $RESOLUTION -S 11 --jpeg $QUALITY \
   --title "Sopot/Abrahama Street (PL)" \
   --subtitle "View from my window" \
   --info "Logitech_Webcam_C270@raspberryPi ($RESOLUTION)" \
   --save $OUTPUT_DIR/image.jpg -q

## Rotate photos every two weeks
## Week number modulo 2 (0 or 1)
WEEK_NO=$(($WEEK % 2))
FILE_OUT="${WEEK_NO}${DAY_OF_WEEK}_$HOUR$MINUTE"

## Wundergound expects the file is `image.jpg'.
## To preserve from overwriting rename:
cd $OUTPUT_DIR && cp image.jpg image_$FILE_OUT.jpg

./sun_calc.py is a Python script (I am not Python programmer BTW):

#!/usr/bin/python
import datetime
import argparse
import pytz
from astral import Astral
city_name = 'Sopot'

parser = argparse.ArgumentParser()
parser.add_argument("-date", type=str, help="Date as yyyy/mm/dd")
parser.add_argument("-city", type=str, help="City name")
parser.add_argument("-param", type=str, help="dusk sunrise sunset or dawn")
parser.add_argument("-verbose", help="Icrease verbosity", action="store_true")
args = parser.parse_args()

dat = args.date
city_name = args.city
param = args.param
verb_level = args.verbose

[year, month, day] = dat.split("/");

year = int(year)
month = int(month)
day = int(day)

a = Astral()
city = a[city_name]

a.solar_depression = 6 ## sd can be:  6, 12, 18

timezone = city.timezone

sun = city.sun(date=datetime.date(year, month, day), local=False)
sun_local = city.sun(date=datetime.date(year, month, day), local=True)

time_now = datetime.datetime.utcnow().replace(tzinfo = pytz.utc)

if verb_level > 0:
        print('solar_depressions: ' + str(a.solar_depression))

        print city_name + " " + str(time_now) + " " + str(sun[param]) \
	        + " (" + str(sun_local[param]) + ")"

print time_now > sun[param]

The script based on astral package can compute dusk/dawn time (among other things) and compares it to the current time. If current time is past dusk/dawn (specified as a command line parameter) ./sun_calc.py returns True. Otherwise it returns False.

The astral package does not contains Sopot but it is easy to add it just by editing astral.py (before installation of course):

Sopot,Poland,54°44'N,18°55'E,Europe/Warsaw

A short test demonstrating that for Sopot and Warsow the script returns significantly different results:

./sun_calc.py -date 2013/01/21 -city Sopot -param dawn -verbose
solar_depressions: 6.0
Sopot 2013-01-21 09:17:11.368979+00:00 2013-01-21 06:09:47+00:00 (2013-01-21 07:09:47+01:00)
./sun_calc.py -date 2013/01/21 -city Warsaw -param dawn -verbose
solar_depressions: 6.0
Warsaw 2013-01-21 09:17:46.172157+00:00 2013-01-21 05:53:22+00:00 (2013-01-21 06:53:22+01:00)
True

So there is circa 15 minutes difference between Sopot which is some 300 km to the North from Warsaw.

url | Mon, 21/01/2013 10:24 | tagi: , , , , ,
Raspberry Pi: BMP085 pressure/temperature sensor




My BMP085 sensor

Yesterday I have got a letter containing BMP085 pressure sensor which I bought on ebay on November 20th 2012 (yes the post made a history with +50 days delivery from China).

To connect BMP085 to RPI first one has to install (in case both packages are not installed yet):

pi@raspberrystar ~ $ sudo apt-get install i2c-tools
pi@raspberrystar ~ $ sudo apt-get install python-smbus

Now one has to enable i2c in raspbian. First one has to add the user pi to the group i2c:

pi@raspberrystar ~ $ sudo adduser pi i2c

Next one has to check the contents of /etc/modprobe.d/raspi-blacklist.conf and /etc/modules:

pi@raspberrystar ~ $ less /etc/modprobe.d/raspi-blacklist.conf
# blacklist spi and i2c by default (many users don't need them)

blacklist spi-bcm2708
blacklist i2c-bcm2708

pi@raspberrystar ~ $ less /etc/modules
...
i2c-dev
i2c-bcm2708

Some users advocate to remove i2c-bcm2708 from blacklisted modules but this seems unneccessary as:

pi@raspberrystar ~ $ lsmod | grep i2c
i2c_bcm2708             3542  0 
i2c_dev                 5587  0 

so I have i2c_bcm270 w/o modifying /etc/modprobe.d/raspi-blacklist.conf

Reboot now to activate the new settings

Hardware

The board my sensor came on has eight pins. There are boards with 6 pins as well which seems to be more popular. Only four out of 8 pins are used and the connections are as follows (see pictures):
GND goes to Ground on the Pi (P1-05)
3.3 goes to 3V3 on the Pi (P1-01)
SDA goes to SDA on the Pi (P1-02)
SCL goes to SCL on the Pi (P1-03)

In Reading data from a Bosch BMP085 with a Raspberry Pi 6-ping sensor is used and the pins connections are different. I have tried but it does not work for my sensor.

I connect sensor to RPI using wires with female jumpers on both ends.

To check if the sensor (or other i2c device) is connected correctly, one can run i2cdetect:

pi@raspberrystar ~ $ i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- 77                

77 in the last row indicates that sensor is connected properly (otherwise the output will consists of rows of '--' only).

Software

To get data from the sensor one has to install Adafruit-Raspberry-Pi-Python-Code or compile small C program available here:

## Download john.geek's C application:
wget http://www.john.geek.nz/wp-content/uploads/2012/08/testBMP085.c
wget http://www.john.geek.nz/wp-content/uploads/2012/12/smbus.c
wget http://www.john.geek.nz/wp-content/uploads/2012/12/smbus.h

## Compile & run it
gcc -Wall -o testBMP085 ./smbus.c ./testBMP085.c
./testBMP085

## Download >Adafruit's one:
git clone https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git
cd Adafruit-Raspberry-Pi-Python-Code
cd Adafruit_BMP085

## Run
python Adafruit_BMP085_example.py

Note: testBMP085 works with sensor connected to RPi as described in this post (not as described by john geek).

BTW: the pressure is identical as reported by my WH 2080 weather station. Perhaphs WH 2080 use exactly the same sensor!

url | Wed, 16/01/2013 11:12 | tagi: , ,
Raspberry Pi: podłączenie kamery do wundergound.com

View from my Window
Widok z mojego okna

Dziś uruchomiłem starą kamerę Logitech Webcam C200 na Raspberry Pi (bez żadnych problemów--wystarczy wsadzić kabel USB). Chcę cyklicznie robić zdjęcia tego co widzę z mojego okna i publikować je na wunderground.com. Spróbowałem zastosować do tego celu program fswebcam.

BTW dobry opis kilku popularnych programów służących do obsługi kamer video jest tutaj.

Aby zainstalować fswebcam należy wykonać:

# apt-get install fswebcam

Uruchamiam fswebcam za pomocą następującego skryptu (cf. Raspberry Pi -- Webcam streaming):

#!/bin/bash
OUTPUT_DIR=/var/www/cam/fswebcam-output

fswebcam -r 640x480 -S 11 --jpeg 95 \
        --title "Sopot/Abrahama Street (PL)" \
        --subtitle "View from my window" \
        --info "Hardware: Logitech_Webcam_C200@raspberryPi" \
        --save $OUTPUT_DIR/image.jpg -q

Aby publikować obrazki na wunderground.com należy kamerę zarejestrować do czego służy prosty formularz. Obrazki mogą być wysyłane na konto ftp na wunderground.com albo pobierane z udostępnionego publicznego konta (w tym drugim przypadku należy podczas rejestracji podać adres URL tegoż konta). Ja wybrałem ftp i rejestracja zakończyła się podaniem nazwy serwera ftp + nazwy użytkownika. Hasło jest takie samo jak to używane do logowania się na konto WWW na wunderground.com.

Do ładowania obrazków używam skryptu (cf. tutaj):

REMOTE='webcam.wunderground.com'
USER='hrpunioCAM1'

PASSWORD='#####'
FTPLOG='/tmp/ftplog'
date >> $FTPLOG

ftp -n $REMOTE <<_FTP>>$FTPLOG
quote USER $USER
quote PASS $PASSWORD
bin
lcd /var/www/cam/fswebcam-output
put image.jpg
quit
_FTP

Obrazki są generowane i wysyłane co kilka minut dzięki stosownemu wpisowi w pliku crontab.

Link do obrazków z mojej kamery wunderground.com jest tutaj.

url | Tue, 15/01/2013 09:45 | tagi: , ,
Raspberry Pi: registering webcamera at wundergound.com

View from my Window
View from my Window

Today I connected old Logitech Webcam C200 to my Raspberry Pi. I just wanted to capture single frames (at a specified time interval, say every 10 minutes) and upload resulting images to wunderground.com. I tried to use fswebcam for that purpose.

BTW a good description of available software for WebCams can be found here.

To install fswebcam one have to execute:

# apt-get install fswebcam

I run fswebcam with the following bash script (borrowed from Raspberry Pi -- Webcam streaming):

#!/bin/bash
OUTPUT_DIR=/var/www/cam/fswebcam-output

fswebcam -r 640x480 -S 11 --jpeg 95 \
        --title "Sopot/Abrahama Street (PL)" \
        --subtitle "View from my window" \
        --info "Hardware: Logitech_Webcam_C200@raspberryPi" \
        --save $OUTPUT_DIR/image.jpg -q

To display one's images at wunderground.com one have to register the camera with a simple form. The images can be uploaded to ftp account at wunderground.com or they can be retrieved from the public URL. As I have decided to upload them I have got ftp account credentials upon sucessfull registration (server and user name). The password is the same as for my wunderground.com WWW account.

I upload images withe following bash script borrowed from here:

REMOTE='webcam.wunderground.com'
USER='hrpunioCAM1'

PASSWORD='#####'
FTPLOG='/tmp/ftplog'
date >> $FTPLOG

ftp -n $REMOTE <<_FTP>>$FTPLOG
quote USER $USER
quote PASS $PASSWORD
bin
lcd /var/www/cam/fswebcam-output
put image.jpg
quit
_FTP

Images are produced and uploaded every few minutes---the scripts are executed with appropriate crontab entries.

A link to my webcam at wunderground.com is here.

url | Mon, 14/01/2013 23:38 | tagi: , ,