f-log

just another web log

30 Jan 2016:
skywriter firmware madness fixed by the pirates
I meant to detail the fun I had the SkyWriter Hat the following is mostly taken from my forum post
http://forums.pimoroni.com/t/solved-skywriter-firmware-info-error/1566


Linux rpihobby01 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7l GNU/Linux

curl -sSL get.pimoroni.com/skywriter | bash
sudo apt-get install python-smbus
sudo reboot

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


So I pretty sure that means its all setup, but I did later run raspi-config again and enable SMB Bus and I2c was set enabled
I also noted all the packages installed before copy&pasting the issue


pi@rpihobby01:~/skywriter-hat-master/python/examples $ sudo ./test.py
Got firmware info

Got firmware info

Got firmware info

...

^CTraceback (most recent call last):
File "./test.py", line 37, in <module>
    signal.pause()
KeyboardInterrupt
Got firmware info


all the SkyWriter apps had the same issue.

I then found a pending pull-request from a user trying to identify firmware issues so had a go at running that.


pi@rpihobby01:~ $ mkdir tmp
pi@rpihobby01:~ $ cd tmp
pi@rpihobby01:~/tmp $ git clone https://github.com/besherman/skywriter-hat.git
Cloning into 'skywriter-hat'...
remote: Counting objects: 236, done.
remote: Total 236 (delta 0), reused 0 (delta 0), pack-reused 236
Receiving objects: 100% (236/236), 1.99 MiB | 1.00 MiB/s, done.
Resolving deltas: 100% (88/88), done.
Checking connectivity... done.
pi@rpihobby01:~/tmp $ cd skywriter-hat/python/library/
pi@rpihobby01:~/tmp/skywriter-hat/python/library $ sudo python setup.py install
running install
running bdist_egg
running egg_info
creating skywriter.egg-info
writing requirements to skywriter.egg-info/requires.txt
writing skywriter.egg-info/PKG-INFO
writing top-level names to skywriter.egg-info/top_level.txt
writing dependency_links to skywriter.egg-info/dependency_links.txt
writing manifest file 'skywriter.egg-info/SOURCES.txt'
reading manifest file 'skywriter.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'skywriter.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
creating build
creating build/lib.linux-armv7l-2.7
copying skywriter.py -> build/lib.linux-armv7l-2.7
creating build/bdist.linux-armv7l
creating build/bdist.linux-armv7l/egg
copying build/lib.linux-armv7l-2.7/skywriter.py -> build/bdist.linux-armv7l/egg
byte-compiling build/bdist.linux-armv7l/egg/skywriter.py to skywriter.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying skywriter.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying skywriter.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying skywriter.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying skywriter.egg-info/requires.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying skywriter.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/skywriter-0.0.2-py2.7.egg' and adding 'build/bdist.linux-armv7l/egg' to it
removing 'build/bdist.linux-armv7l/egg' (and everything under it)
Processing skywriter-0.0.2-py2.7.egg
Removing /usr/local/lib/python2.7/dist-packages/skywriter-0.0.2-py2.7.egg
Copying skywriter-0.0.2-py2.7.egg to /usr/local/lib/python2.7/dist-packages
skywriter 0.0.2 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/skywriter-0.0.2-py2.7.egg
Processing dependencies for skywriter==0.0.2
Searching for smbus==1.1
Best match: smbus 1.1
smbus 1.1 is already the active version in easy-install.pth

Using /usr/lib/python2.7/dist-packages
Finished processing dependencies for skywriter==0.0.2
pi@rpihobby01:~/tmp/skywriter-hat/python/library $ cd ../examples/
pi@rpihobby01:~/tmp/skywriter-hat/python/examples $ ./test.py
Got firmware info

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
File "build/bdist.linux-armv7l/egg/skywriter.py", line 103, in run
    if self.todo() == False:
File "build/bdist.linux-armv7l/egg/skywriter.py", line 332, in _do_poll
    handle_firmware_info(data)
File "build/bdist.linux-armv7l/egg/skywriter.py", line 289, in handle_firmware_info
    raise Exception("No valid GestIC Library could be located")
Exception: No valid GestIC Library could be located

^CTraceback (most recent call last):
File "./test.py", line 37, in <module>
    signal.pause()
KeyboardInterrupt


The key bit to note is "No valid GestIC Library could be located" which is the clever bit on the board and detailed here
https://github.com/pimoroni/skywriter-hat/tree/master/datasheets

Turns out that user had opened an issue on GitHub
https://github.com/pimoroni/skywriter-hat/issues/7

Pimoroni emailed me the firmware and it was easy to unpack and run a Python script that fixed the SkyWriter Hat.

I asked why this was not available in the GitHub repository and if a lot of people were affected.

One; the failure rate had been quite small (lucky me!) and two; there would be confusion between the Hat and full sized SkyWriters not to mention that the user should never have to flash their SkyWriter. Which all sounds quite reasonable.
30 Jan 2016:
what 3D skywriter theremin puredata?
I my last post about the SkyWriter Hat from Pimoroni we had a little problem following the instructions

theremin.pd

Show off your musical prowess and melodic genius with this groundbreaking 3D theremin.

Designed to be run within X, startx first.

To run, you'll need to install PD:

sudo apt-get install pd

Run as follows:

pd theremin.pd


but it turns out this is just a PureData file so you can run a setup like the "synth.py", which does act as a theremin. In fact the "synth.py" file contains an import for "pdtone.py" which in turn has the same data for PureData in it.

But I really like the idea of a 3D Theremin on the Pi controlled by the SkyWriter Hat.

Step 1: Get Pygame showing something(blank screen)
Step 2: Get Pygame with its blank screen running the Theremin code
Step 3: Get data from the SkyWriter Hat on the Pygame screen
Step 4: Display the real time 3D position in Pygame
Step 5: Add some GUI stuff about volume and pitch
Step 6: Submit a pull request to Pimoroni for inclusion in there GitHut repo


28 Jan 2016:
skywriter pi magic
The SkyWriter Hat from Pimoroni is small near-field plate that can detect capacitive objects like your hand/finger in 3D space. It has built in the ability to detect gestures like touch, flick and "air wheels".

As it is a Hat and comes pre-assembled all you have to do is connect it and fits perfectly on a Raspberry Pi 2 and download the code.
https://github.com/pimoroni/skywriter-hat

curl -sSL get.pimoroni.com/skywriter | bash

./test.py

(you do not need sudo in front of the applications any more!)

Then I found I had bad firmware, but the team at Pimoroni forums sorted me out. Will blog about it another day.

Generates nothing until you put your hand over the Hat
(0.1373443603515625, 0.4677734375, 0.583984375)
(0.1373443603515625, 0.469085693359375, 0.584747314453125)
(0.1373443603515625, 0.4705810546875, 0.585723876953125)
(0.1373443603515625, 0.472259521484375, 0.5869903564453125)
(0.1373443603515625, 0.4741668701171875, 0.588623046875)
(0.1373443603515625, 0.4763336181640625, 0.5908355712890625)
('Airwheel:', 58.1)
(0.0, 0.9999847412109375, 0.0)
(0.005462646484375, 0.9999847412109375, 0.0)
('Airwheel:', 58.2125)
(0.03070068359375, 0.9999847412109375, 0.0)
(0.072998046875, 0.9999847412109375, 0.0)
(0.1355743408203125, 0.9999847412109375, 0.0)
(0.2272796630859375, 0.9999847412109375, 0.0)
('Touch!', 'north')
(0.359344482421875, 0.9999847412109375, 0.0)
(0.5264434814453125, 0.9999847412109375, 0.0)
('Tap!', 'north')
(0.0, 0.9999847412109375, 0.334686279296875)
(0.0, 0.9999847412109375, 0.3322906494140625)
('Got a flick!', 'north', 'south')
^CTraceback (most recent call last):
File "./test.py", line 37, in <module>
    signal.pause()
KeyboardInterrupt

The numbers stream up the screen at high speed and CTRL+C exits the program.
I have edited the massive output to highlight instances of "presses", "flicks" and "airwheels"(rotating your finger as if stirring the SkyWriter Hat, but not touching it).

I found it odd that things other that my hand/finger affected the values. could this be a short range but highly sensitivity range detector? This will need some further investigation.

Also in the examples folder are code for keyboard, mouse and mouse driver but I am not really that interested, but the "synth.py" and "thermin.pd" that sounds(pun intended) interesting.

"synth.py" takes a while to get going
./synth.py
Populating temp PD file: /tmp/tmp_YpD0g
Started PD with PID: 12837
File: /tmp/tmp_YpD0g
Attempting to connect to PD
Connected to PD


Before it starts capturing input. The left-right is the volume, loudest on the right. The pitch is distance from the sensor and give a sort of thermin experience. CTRL+C again to exit.

The 3D graphical thermin did not work for me
pd ./theremin.pd
sh: 1: wish: not found
watchdog: signaling pd...
watchdog: signaling pd...
watchdog: signaling pd...
watchdog: signaling pd...
watchdog: signaling pd...
watchdog: signaling pd...
watchdog: signaling pd...


Running with sudo did not help :(

Something to look at another day. But at least it gave me an excuse to try the keyboard and mouse programs.

The "keyboard.py" just sends the cursor keys and enter. So by starting the app and the using my real mouse to select the menu I could move up and down and on to sub-menus and even execute programs by floating over the SkyWriter!
"mouse.py" is how you would expect, where you move on the Hat the mouse moves but of course the Hat is very small so any movements are greatly exaggerated. Fun demo.

27 Jan 2016:
ssh Y not X Pi winner
I like to use my linux machine running X with the Pi not running X but having GUI apps available with no connected display(i.e. Headless)

ssh -X user@ipa.ddr.ess.pi
Sometimes works for remotely running Pi hosted GUI apps on my (non-Pi)machine.
the fix was to use -Y
ssh -Y user@ipa.ddr.ess.pi

oh, and you do not need to export the DISPLAY variable, in fact that is a bad thing when trying to run X apps remotely on the your machine not the Pi.
On the other hand if you want to run GUI apps on a remote Pi on its connected display then
export DISPLAY=:0.0
is very required.
15 Jan 2016:
devops manager is power mad
One thing I did not get around to blogging about last year was my change of job.

Prior to the change I was a Senior .NET developer. Now I am DevOps Manager!

I have my old colleagues asking me what its like in my new role and I just explain it is exactly the same as before except I have more power!

When I was Senior Dev I tried to make thing better, post build scripts, continuous integration, build quality etc as well as the day to day coding.

My new position gives me the reach and power to do that and much more, including the odd bit of .NET coding, though it is mainly Powershell now.

My teams motto is simply "automate everything" and I love it!
14 Jan 2016:
2015 year review is a pat on the back
I always think that I do *nothing* then I do my end of year review and find I have done quite a bit.

61 posts of which 25 were Raspberry Pi related. Some of the posts were HUGE, need to make that a new years resolution, smaller posts.

Since introducing a spell checker into the flog process I was surprised to find so many mistakes. Most commonly "were" where "where" should have been.

What a wide list of subjects

Raspberry Pi
Kids
Kindle
Google Calender
Pebble watch
NodeJS
Blender
Gentoo
Hacking
PIR camera rig
Joggler
Minecraft party

The list just goes on and on!
02 Jan 2016:
note to self review 2015
Next job is to do the 2015 year review.

At least 2014 was done last year.
02 Jan 2016:
Raspberry Pi gets a cheap LCD face
got another Pi for Xmas. A new Raspberry Pi 2 model B, which is the most powerful Pi to date.

One of the things I bought last year was an LCD 16x2 screen that I never got around to hooking up.

It would seem that not all LCD 16x2 screens are exactly alike but are so mostly alike that anyone of the many many tutorials are viable. Saying that I did look for sometime before I found the excellent video embedded below from rdagger68


http://www.rototron.info/lcd-display-tutorial-for-raspberry-pi/

What really makes it for me in this video is that graphics showing which pin goes where and the fact it is all done Live. Which in turn gave me the confidence to try it with the Pi on and running. That and it was only 6 GPIO pins!

The only things I did differently from the video regarding wiring was adding a 10kΩ pot(variable resistor) and using a different Ground/GND pin.

16x2 LCD attached to bread board attached to Raspberry Pi 2 Model B

The 10kΩ pot is to limit the LCD back light. The hardware in the video has an inbuilt resistor but all the other tutorials I could find said use the pot and tweak it to set the brightness.

Once I had soldered the header pins on and the wired it to the Pi and the LCD was displaying a line of filled squares the software was a little more time consuming.

First, the file from Raspberry Pi Spy had changed.

The pin changes in the video were still valid, excluding the last one that was noted to not being used.

# Define GPIO to LCD mapping
LCD_RS = 26
LCD_E = 19
LCD_D4 = 13
LCD_D5 = 6
LCD_D6 = 5
LCD_D7 = 11


The lcd_init() code was updated as in the video but the test code(when run from the same folder as the py module) ended up being
sudo python
import os
import lcd_16x2
lcd_16x2.lcd_init()
lcd_16x2.main()

Which successful ran the demo.

But I wanted more and the the video references to how the code worked had problems. Not serious problems just annoying, the author had obviously updated his code.

The commands to set the LCD line are not required when using the lcd_string method and the second parameter in the video is now the line(address) not the justification type.

I decided that was not very useful and added the code back in.


def lcd_string(message, line, justified = 0) :
# Send string to display
if justified == 0 :
    message = message.ljust(LCD_WIDTH," ")
elif justified == 1 :
    message = message.center(LCD_WIDTH," ")
else :
    message = message.rjust(LCD_WIDTH," ")

if line == 1 :
    line = LCD_LINE_1
else :
    line = LCD_LINE_2

lcd_byte(line, LCD_CMD)

for i in range(LCD_WIDTH):
    lcd_byte(ord(message[i]),LCD_CHR)


Now I can pass the line as 1 or 2 and the justification as 0 for left justified, 1 for centred and 2 for right justified, or default to left aligned.
e.g.

import os
import lcd_16x2
lcd_16x2.lcd_init()
lcd_16x2.lcd_string("LeftAlign Ln1",1,0)
lcd_16x2.lcd_string("RightAlign Ln2",2,2)
lcd_16x2.lcd_string("Center Ln1",1,1)


I did not try the AdaFruit libraries and numerous posts had mentioned problems with it and I did not need any of its extra abilities.

There is the possibility of using custom and extended characters on the LCD
http://symlink.dk/electro/hd44780/

And rdagger68/rototron did a follow up using I2c to control the same LCD with just 3 GPIO pins(and 2 are for GND and 5v)!
http://www.rototron.info/using-an-i2c-lcd-display-with-a-raspberry-pi/
loading results, please wait loading animateloading animateloading animate
[More tags]
rss feed

email

root

flog archives


Disclaimer: This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk In fact I'm not responsible for anything ever, so there!

[Pay4Foss banner long]