New post drafts

James Peret 7 years ago
parent
commit
73c939279a

+ 37 - 0
_drafts/2016-03-24-jasper-install.md

@@ -0,0 +1,37 @@
1
+---
2
+layout: post
3
+title:  "Jasper Install"
4
+date:   2016-03-24 21:14:01
5
+categories: article diary
6
+published: false
7
+image:
8
+  feature: artpimp-radio.jpg
9
+  topPosition: 0px
10
+bgContrast: dark
11
+bgGradientOpacity: darker
12
+syntaxHighlighter: yes
13
+---
14
+
15
+This tutorial will cover how to install the Jasper speech project in a Raspberry Pi 3 using the Raspbian Jesse OS.
16
+
17
+## Configuring Audio
18
+
19
+Follow this [tutorial](http://cagewebdev.com/index.php/raspberry-pi-getting-audio-working/) to get audio working on the raspberry pi using a external microfone or sound card. To keep your configurations aftwards, follow this [tutorial](http://www.linuxcircle.com/2013/05/08/raspberry-pi-microphone-setup-with-usb-sound-card/.)
20
+
21
+## python pip problems
22
+
23
+If you have problems with pip, try uninstalling it and then using *easy_install* to reinstall pip:
24
+
25
+```bash
26
+    apt-get remove python-pip
27
+    easy_install pip
28
+```
29
+
30
+## Links
31
+
32
+- [Making Jasper use the AT&T Speech API](http://changingjasper.blogspot.de/2014/06/making-jasper-use-at-speech-api.html)
33
+- [Better system for sharing modules](https://github.com/jasperproject/jasper-client/issues/163) - Interesting conversation about a module sharing system
34
+- [Jasper Module Hub](http://jaspermoduleshub.herokuapp.com/) - Experimental website with some jasper modules
35
+- [Parsing English in 500 lines of Python](https://spacy.io/blog/parsing-english-in-python)
36
+- [Give "Jasper" a different name](https://github.com/jasperproject/jasper-client/issues/8)
37
+- [Building application with pocketsphinx](http://cmusphinx.sourceforge.net/wiki/tutorialpocketsphinx)

+ 183 - 0
_drafts/2016-04-25-RPI-Touchscreen.md

@@ -0,0 +1,183 @@
1
+---
2
+layout: post
3
+title:  "Raspberry Pi Touchscreen Tutorial"
4
+date:   2016-04-25 15:25:01
5
+categories: article diary
6
+published: false
7
+image:
8
+  feature:
9
+  topPosition: 0px
10
+bgContrast: dark
11
+bgGradientOpacity: darker
12
+syntaxHighlighter: yes
13
+---
14
+
15
+Sainsmart doesn’t provide any sources or usefull information, but the module is very easy to use.
16
+
17
+First, install the display module on the Raspberry Pi board, and power it.
18
+
19
+Now, install fbtft kernel with SPI DMA support.
20
+
21
+sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update
22
+Download waveshare overlays and copy them in /boot/overlays/.
23
+
24
+cd /tmp
25
+git clone https://github.com/swkim01/waveshare-dtoverlays.git
26
+sudo cp waveshare-dtoverlays/*.dtb /boot/overlays/
27
+Specify this overlay file in your /boot/config.txt along with activating SPI.
28
+
29
+sudo nano /boot/config.txt
30
+Add these 2 lines at the end of the file :
31
+
32
+dtparam=spi=on
33
+dtoverlay=waveshare32b
34
+Enable console on the display
35
+
36
+Edit /boot/cmdline.txt
37
+
38
+sudo nano /boot/cmdline.txt
39
+At the end of the line, add this :
40
+
41
+fbcon=map:10
42
+This is also where you could rotate the console display, with fbcon=rotate:n where n is a different orientation (0,1,2,3)
43
+
44
+Enable X window on the display
45
+
46
+Edit xorg config file and change default framebuffer device (fb0) to our new framebuffer (fb1)
47
+
48
+sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf
49
+Change this line to fb1 :
50
+
51
+Option          "fbdev" "/dev/fb1"
52
+Now, reboot your Pi. Your console should show on the display.
53
+
54
+
55
+5- Console touch calibration
56
+
57
+Edit, 2016.02.14 : A bug in the Debian 8 « Jessie » libsdl component prevents the touchpanel to work reliably in Pygame, from the console. For a workaround, please read this blog article if you are using Debian Jessie.
58
+
59
+Input devices get a device name which depends on the order of detection (/dev/input/eventX).
60
+
61
+These udev rules will create a symlink /dev/input/touchscreen pointing to the touch controller device. Reloading the driver or rebooting is necessary for the change to take effect.
62
+
63
+/etc/udev/rules.d/95-ads7846.rules
64
+
65
+SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{name}=="ADS7846*", SYMLINK+="input/touchscreen"
66
+/etc/udev/rules.d/95-stmpe.rules
67
+
68
+SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen"
69
+Now, reboot.
70
+
71
+In order to use the touch panel with python, X, and to calibrate it, a few packages need loading :
72
+
73
+sudo apt-get install -y libts-bin evtest xinput python-dev python-pip
74
+sudo pip install evdev
75
+
76
+# install ts_test with Quit button
77
+sudo wget -O /usr/bin/ts_test http://tronnes.org/downloads/ts_test
78
+sudo chmod +x /usr/bin/ts_test
79
+To calibrate the touchscreen :
80
+
81
+sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_calibrate
82
+6- X windows touch calibration
83
+
84
+xinput-calibrator provides a way to calibrate the touchpanel for X windows use. Install
85
+
86
+cd /tmp
87
+wget http://tronnes.org/downloads/xinput-calibrator_0.7.5-1_armhf.deb
88
+sudo dpkg -i -B xinput-calibrator_0.7.5-1_armhf.deb
89
+rm xinput-calibrator_0.7.5-1_armhf.deb
90
+Configure xinput-calibrator to autostart with X windows.
91
+
92
+sudo wget -O /etc/X11/Xsession.d/xinput_calibrator_pointercal https://raw.github.com/tias/xinput_calibrator/master/scripts/xinput_calibrator_pointercal.sh
93
+echo "sudo /bin/sh /etc/X11/Xsession.d/xinput_calibrator_pointercal" | sudo tee -a /etc/xdg/lxsession/LXDE-pi/autostart
94
+On first start of X windows a calibration window will be displayed.
95
+
96
+startx
97
+Delete /etc/pointercal.xinput and restart X to recalibrate.
98
+
99
+### Touch panel rotation
100
+
101
+xinput-calibrator doesn’t handle touchpanels with X/Y swapped.
102
+If your calibration results in swapped axis, add these config files.
103
+
104
+`/usr/share/X11/xorg.conf.d/99-ads7846-cal.conf`
105
+
106
+```
107
+Section "InputClass"
108
+        Identifier      "calibration"
109
+        MatchProduct    "ADS7846 Touchscreen"
110
+        Option  "SwapAxes"      "1"
111
+        Option "InvertX" "true"
112
+EndSection
113
+```
114
+
115
+`/usr/share/X11/xorg.conf.d/99-stmpe-cal.conf`
116
+
117
+```
118
+Section "InputClass"
119
+        Identifier      "calibration"
120
+        MatchProduct    "stmpe-ts"
121
+        Option  "SwapAxes"      "1"
122
+        Option "InvertX" "true"
123
+EndSection
124
+```
125
+
126
+### Disable screen blanking
127
+
128
+Edit /boot/cmdline.txt and add consoleblank parameter
129
+
130
+sudo nano /boot/cmdline.txt
131
+add this to the end of the line :
132
+
133
+consoleblank=0
134
+Edit /etc/kbd/config and edit display blanking parameters
135
+
136
+sudo nano /etc/kbd/config
137
+Find these lines and replace the values with 0 (zero) :
138
+
139
+BLANK_TIME=0
140
+POWERDOWN_TIME=0
141
+8- Use the buttons
142
+
143
+The 3 buttons are very easy to use, once pinout is found.
144
+
145
+Here is a very simple python example :
146
+
147
+import RPi.GPIO as GPIO
148
+
149
+GPIO.setmode(GPIO.BOARD)
150
+
151
+GPIO.setup(12, GPIO.IN, pull_up_down = GPIO.PUD_UP)
152
+GPIO.setup(16, GPIO.IN, pull_up_down = GPIO.PUD_UP)
153
+GPIO.setup(18, GPIO.IN, pull_up_down = GPIO.PUD_UP)
154
+
155
+while True:
156
+	if(GPIO.input(12) == 0):
157
+	print(“Button 1 pressed”)
158
+	if(GPIO.input(16) == 0):
159
+	print(“Button 2 pressed”)
160
+	if(GPIO.input(18) == 0):
161
+	print(“Button 3 pressed”)
162
+
163
+GPIO.cleanup()
164
+Save it to /home/pi/buttons.py (for an example) and execute it with
165
+
166
+python /home/pi/buttons.py
167
+Once your are happy with your script, execute it at boot.
168
+
169
+sudo nano /etc/rc.local
170
+Add your script before the exit line, with a « & » to make it non-blocking :
171
+
172
+python /home/pi/buttons.py &
173
+You could find easily adaptable and more advanced scripts on my previous articles here and here.
174
+
175
+9- Conclusion
176
+
177
+This is nice little display with good view angles, a good brightness and 3 usefull buttons. It is also easy to set up, which is nice.
178
+
179
+Sources
180
+- https://github.com/notro/fbtft/wiki/FBTFT-on-Raspian
181
+- http://hardware-libre.fr/2015/07/review-guide-waveshare-sainsmart-3-2-inch-rpi-lcd/
182
+- http://www.circuitbasics.com/raspberry-pi-touchscreen-calibration-screen-rotation/
183
+- [Joy-it 3,2“ Touch-Display-V2 manual](http://files.voelkner.de/1300000-1399999/001380381-an-01-de-8_13_CM__3_2__TOUCH_DISPLAY_320X240_PX.pdf)

+ 50 - 2
_posts/2015-06-27-raspberry-pi-getting-started.markdown

@@ -39,7 +39,7 @@ For more information on creating a disk image of the Raspbian OS on a micro SD c
39 39
 
40 40
 ### First Boot
41 41
 
42
-The username and password for Raspbian “squeeze” are:
42
+The username and password for Raspbian “squeeze” or "Jessie" are:
43 43
 
44 44
     $ Username: Pi
45 45
 
@@ -49,11 +49,52 @@ To start the Raspbian GUI, run the command:
49 49
 
50 50
     $ startx
51 51
 
52
+To enter the Raspbian system settings:
53
+
54
+    $ sudo raspi-config
55
+
52 56
 ### Setting up Wi-Fi and Ethernet
53 57
 
54 58
 To set up multiple wired and wi-fi connections using WICD-CURSES app, follow this [instructions](http://www.raspyfi.com/wi-fi-on-raspberry-pi-a-simple-guide/).
55 59
 
56
-To set up a single wi-fi connection, follow this [instructions](http://www.howtogeek.com/167425/how-to-setup-wi-fi-on-your-raspberry-pi-via-the-command-line/)
60
+To set up a single wi-fi connection on a raspberry pi 3 with Rasbian Jessie, add the following to the ```/etc/wpa_supplicant/wpa_supplicant.conf``` file:
61
+
62
+    network={
63
+      ssid="network_name"
64
+      psk="network_password"
65
+    }
66
+
67
+For more information about setting the wifi, follow this [tutorial](http://www.howtogeek.com/167425/how-to-setup-wi-fi-on-your-raspberry-pi-via-the-command-line/).
68
+
69
+If you want to disable the wifi power management, so that the wifi doesnt turn of due to inactivity, change the file ```/etc/network/interfaces``` and add
70
+```wireless-power off``` to your wifi connection:
71
+
72
+    auto wlan0
73
+    allow-hotplug wlan0
74
+    iface wlan0 inet dhcp
75
+    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
76
+    wireless-power off
77
+    iface default inet dhcp
78
+
79
+You can also run the a command to turn wifi power management off until the next reboot:
80
+
81
+    sudo iwconfig wlan0 power off
82
+
83
+After changing the network configurations, reboot your pi:
84
+
85
+    sudo reboot
86
+
87
+You can check your network status with the following commands. Check if ```inet addr``` is an *IP* in your network.
88
+
89
+    iwconfig
90
+    iwconfig wlan0
91
+    ifconfig
92
+    ifconfig wlan0
93
+
94
+To manualy stop and restart your wifi connection, tun the following commands:
95
+
96
+    sudo ifdown wlan0
97
+    sudo ifup wlan0
57 98
 
58 99
 ### Installing Apps
59 100
 
@@ -118,6 +159,13 @@ To [play a video with VLC thru a ssh session](http://stackoverflow.com/questions
118 159
 
119 160
 [HPlayer](https://github.com/Hemisphere-Project/HPlayer) is a OSC controllable and GPU accelerated video player for Raspberry Pi with OpenGL shaders support.
120 161
 
162
+### Prevent sleeping
163
+
164
+To prevent the Raspberry Pi from turning off the screen or entering in power saving mode, change the following configurations in the file ```/etc/kbd/config``` and the reboot.
165
+
166
+    BLANK_TIME=0
167
+    POWERDOWN_TIME=0
168
+
121 169
 ## Misc
122 170
 
123 171
 ### Useful commands