<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Cédric Bosdonnat - rpi</title><link href="https://bosdonnat.fr/" rel="alternate"></link><link href="https://bosdonnat.fr/feeds/tag/rpi.atom.xml" rel="self"></link><id>https://bosdonnat.fr/</id><updated>2017-02-28T11:22:00+01:00</updated><subtitle>A geek's perspective</subtitle><entry><title>SLES, Raspberry PI and GPIO</title><link href="https://bosdonnat.fr/sles-rpi-gpio.html" rel="alternate"></link><published>2017-02-28T11:22:00+01:00</published><updated>2017-02-28T11:22:00+01:00</updated><author><name>Cédric Bosdonnat</name></author><id>tag:bosdonnat.fr,2017-02-28:/sles-rpi-gpio.html</id><summary type="html">&lt;p&gt;&lt;a href="https://hackweek.suse.com"&gt;SUSE Hackweek 15&lt;/a&gt; just finished. This time I wanted to come up
with a tool and hardware to control my window shutters. The good thing is
that they are already motorized and have wired command. Thus I could
easily hack a GPIO-based solution.&lt;/p&gt;
&lt;p&gt;Obviously I bought some hardware in advance …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;a href="https://hackweek.suse.com"&gt;SUSE Hackweek 15&lt;/a&gt; just finished. This time I wanted to come up
with a tool and hardware to control my window shutters. The good thing is
that they are already motorized and have wired command. Thus I could
easily hack a GPIO-based solution.&lt;/p&gt;
&lt;p&gt;Obviously I bought some hardware in advance to have it on time: I mostly
needed a relay board. I chose the &lt;a href="http://www.sainsmart.com/16-channel-12v-relay-module-for-pic-arm-avr-dsp-arduino-msp430-ttl-logic.html"&gt;16 modules one from Sainsmart&lt;/a&gt;,
with a 12V 2A power supply for it. I could be argued that 16 relays is way
too much to handle one shutter motor, but I need two relays for it (one for
each direction) and my final goal is to control 8 window shutters.&lt;/p&gt;
&lt;p&gt;To add some salt to this hackweek, I deciced to run a
&lt;a href="https://www.suse.com/products/arm/raspberry-pi/"&gt;SLES 12 SP2 for Raspberry Pi&lt;/a&gt; on my Raspberry Pi 3.
The fact is that none of the GPIO library was working on SLES as they were
expecting some rasbian-specific things.&lt;/p&gt;
&lt;p&gt;Thus this hackweek was a nice opportunity to get &lt;a href="https://sourceforge.net/p/raspberry-gpio-python/wiki/Home/"&gt;RPi.GPIO&lt;/a&gt; and
&lt;a href="https://github.com/intel-iot-devkit/mraa/"&gt;mraa&lt;/a&gt; to work on SLES. The patches are pending upstream review
&lt;a href="https://sourceforge.net/p/raspberry-gpio-python/tickets/149/"&gt;here&lt;/a&gt;, &lt;a href="https://sourceforge.net/p/raspberry-gpio-python/tickets/150/"&gt;here&lt;/a&gt; and &lt;a href="https://github.com/intel-iot-devkit/mraa/pull/655"&gt;here&lt;/a&gt;. The patched packages
for openSUSE Tumbleweed and SLES are pending review as well.&lt;/p&gt;
&lt;p&gt;Just not to forget the final goal of my hackweek, here are some pictures
of how I hacked the shutter to detect the end positions:&lt;/p&gt;
&lt;p&gt;&lt;img alt="detector setup" src="https://bosdonnat.fr/data/photos/detector.jpg"&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="end detection system" src="https://bosdonnat.fr/data/photos/end_detected.jpg"&gt;&lt;/p&gt;
&lt;p&gt;The code for the prototype can be found on &lt;a href="https://github.com/cbosdo/shutter"&gt;github&lt;/a&gt;, but
it's going to change a lot sooner or later. I also had to create a
&lt;a href="http://fritzing.org"&gt;fritzing&lt;/a&gt; part for the relay board: those in need can find it
&lt;a href="http://forum.fritzing.org/t/sainsmart-16-channels-relay-board/3170"&gt;here&lt;/a&gt;.&lt;/p&gt;</content><category term="Hacks"></category><category term="SUSE"></category><category term="rpi"></category></entry><entry><title>Media Center with Raspberry Pi</title><link href="https://bosdonnat.fr/rpi-media-center.html" rel="alternate"></link><published>2016-11-16T20:00:00+01:00</published><updated>2016-11-16T20:00:00+01:00</updated><author><name>Cédric Bosdonnat</name></author><id>tag:bosdonnat.fr,2016-11-16:/rpi-media-center.html</id><summary type="html">&lt;p&gt;I know there are already tons of media center uses of raspberry pi,
so is different with this one? I wanted to replace the old mini CD
player by something I could easily hack. Thus my requirements were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a media center able to read audio CDs and DVDs (I know …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;I know there are already tons of media center uses of raspberry pi,
so is different with this one? I wanted to replace the old mini CD
player by something I could easily hack. Thus my requirements were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a media center able to read audio CDs and DVDs (I know I'm a dinosaur)&lt;/li&gt;
&lt;li&gt;easily operated by young kids&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thus I came to a solution with a USB DVD drive, a few buttons connected
to GPIO, and a sound amplifier. Finding a nice and rather small box for
all these pieces needed quite some thinking, and I came up with a wooden
box of Port wine.&lt;/p&gt;
&lt;h2&gt;Stuffs I needed:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;a raspberry pi 2&lt;/li&gt;
&lt;li&gt;an audio amp. The &lt;a href="http://www.velleman.eu/products/view/?country=be&amp;amp;lang=en&amp;amp;id=387602"&gt;Velleman MK190 kit&lt;/a&gt; graciously provided by
  &lt;a href="http://www.hadess.net/2015/09/philips-wireless-modernised.html"&gt;Bastien&lt;/a&gt; does work, just needs 12V power&lt;/li&gt;
&lt;li&gt;a power adapter producing 12V and 5V. I got one from an old hard drive
  external case.&lt;/li&gt;
&lt;li&gt;an USB DVD drive, just had to care about power and noise to choose it&lt;/li&gt;
&lt;li&gt;an HDMI extension cable&lt;/li&gt;
&lt;li&gt;an ethernet extension cable&lt;/li&gt;
&lt;li&gt;a remote control: I chose the MX3 air mouse&lt;/li&gt;
&lt;li&gt;various cables&lt;/li&gt;
&lt;li&gt;spare push buttons and soldering tools&lt;/li&gt;
&lt;li&gt;a sound plug (taken from the old CD player device)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Putting it together&lt;/h2&gt;
&lt;p&gt;I cut the buttons in some pine board I had, and to get them bump back
to their original position after being pushed I used the plastic thing
used for keyboard keys. Here is how it looks like: &lt;/p&gt;
&lt;p&gt;&lt;img alt="Front of the buttons piece" src="https://bosdonnat.fr/data/rpi-player/buttons.jpg"&gt;&lt;/p&gt;
&lt;p&gt;The circuit for the GPIO is rather simple, just that I needed four buttons.
The board is then fixed on the buttons holder medium board. See the
assembled result here:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Assembled buttons circuitry" src="https://bosdonnat.fr/data/rpi-player/buttons_back.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Then I had to carve the wood with chisels to get the wholes for the
buttons, the DVD tray and various outputs (HDMI, ethernet, audio).&lt;/p&gt;
&lt;p&gt;The volume button from the MK190 kit couldn't fit in the whole setup, thus I
had to make one with some old round pieces of wood (a chair foot typically).&lt;/p&gt;
&lt;p&gt;A few nails are maintaining the DVD player in place to avoid it to slide
when inserting a disk in it. I also screwed the buttons board and then wired
it all. Here is the whole thing from various angles:&lt;/p&gt;
&lt;p&gt;Inside:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Inside view" src="https://bosdonnat.fr/data/rpi-player/inside.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Front (you will see that I still haven't painted anything on the buttons):&lt;/p&gt;
&lt;p&gt;&lt;img alt="Front side" src="https://bosdonnat.fr/data/rpi-player/front.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Back:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Back side" src="https://bosdonnat.fr/data/rpi-player/back.jpg"&gt;&lt;/p&gt;
&lt;h2&gt;Software&lt;/h2&gt;
&lt;p&gt;For the media center it was rather clear to me that I'll use &lt;a href="https://kodi.tv"&gt;Kodi&lt;/a&gt;, I just
had to decide for the distro. I chose OSMC for the while rather than minimal
ones like &lt;a href="https://libreelec.tv/"&gt;LibreElec&lt;/a&gt; or &lt;a href="http://openelec.tv/"&gt;OpenElec&lt;/a&gt; as it is easier to hack the software
on it without having to rebuild it all.&lt;/p&gt;
&lt;p&gt;I hit a few problems with Kodi:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;auto playing audio CDs and DVDs wasn't that straight forward, I had to write
  a small udev rule for it&lt;/li&gt;
&lt;li&gt;Some audio CDs aren't playing with Kodi's native player. I had to setup
  &lt;a href="http://www.videolan.org/"&gt;VLC&lt;/a&gt; as an external player. I know it's rather hacky, but at least it
  works for the time beeing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And of course I had to write some python code for the GPIO buttons. It's so
ugly at the moment, that I won't release it as is... and I still hope to be
able to fix that libcdio usage bug to get rid of the external player.&lt;/p&gt;
&lt;p&gt;After some time using it, I also discovered that I need to add a power switch
to gracefully turn the raspberry pi on or off. So the project is not yet
finished.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT: &lt;/strong&gt; I purchased a &lt;a href="http://www.mausberrycircuits.com/collections/frontpage/products/shutdown-circuit-use-your-own-switch"&gt;Mausberry USB port use-your-own-switch shutdown
circuit&lt;/a&gt;. At least the whole system can now be turned off easily.&lt;/p&gt;</content><category term="Hacks"></category><category term="rpi"></category></entry></feed>