Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: Silver1omo on September 25, 2014, 03:09:42 AM

Title: picore and python
Post by: Silver1omo on September 25, 2014, 03:09:42 AM
I have installed picoreplayer in a RPI B and decided to add GPIO support to activate/deactivate a relay and turn off/on the amp.
Code: [Select]
tc@piCorePlayer:~$ uname -a
Linux piCorePlayer 3.14.4-piCore+ #1 PREEMPT Sat May 31 15:15:24 CEST 2014 armv6l GNU/Linux

Faced problems adding extension due to the limited size of the tce partition so I resized it:
/dev/mmcblk0p2          906.6M     57.8M    805.4M   7% /mnt/mmcblk0p2

And then tried to install python using tce-load -wi python.tcz, it downloaded but did not install, so I tried tce-load -i python.tcz
Code: [Select]
tc@piCorePlayer:~$ tce-load -i python.tcz
mount: mounting /dev/loop50 on /tmp/tcloop/python failed: Invalid argument

Spent some time searching in google with no luck. Any help will be appreciated.
Title: Re: picore and python
Post by: lykkedk on September 25, 2014, 05:01:13 AM
Hey  :)

Look here, and when fixed, you can try again :

http://forum.tinycorelinux.net/index.php/topic,16439.0.html (http://forum.tinycorelinux.net/index.php/topic,16439.0.html)

Regards... Jesper
Title: Re: picore and python
Post by: Silver1omo on September 25, 2014, 11:10:10 AM
Jesper, I read that thread, but don't see what I need to fix.
Title: Re: picore and python
Post by: lykkedk on September 25, 2014, 11:31:48 AM
Did you expand mmcblk0p2, reboot and resize.

Its explained in the Readme file

Jesper
Title: Re: picore and python
Post by: bmarkus on September 25, 2014, 11:46:05 AM
Where is your /tce directory?
Title: Re: picore and python
Post by: Silver1omo on September 25, 2014, 11:54:03 AM
Jesper, I did.
Bela, is in mnt/mmcblk0p2/tce

I just re-installed picoreplayer and resized and expanded mmcblk0p2 then installed compile-essentials, python-dev and python-RPi.GPIO. It is working now.
Title: Re: picore and python
Post by: lykkedk on September 25, 2014, 12:00:35 PM
Cool :)

Let us see, when you have set up youre
Relay, schematic etc...

Would be nice to see

Jesper
Title: Re: picore and python
Post by: Silver1omo on September 25, 2014, 02:59:04 PM
This looks like it can work:
http://raspberrypihobbyist.blogspot.com/2012/10/revision-to-relay-circuit.html
Title: Re: picore and python
Post by: Paul_123 on September 26, 2014, 04:24:11 PM
I just use these

http://www.ebay.com/itm/5V-Four-4-Channel-Relay-Module-With-optocoupler-For-PIC-AVR-DSP-ARM-Arduino-8051-/310574401892?pt=LH_DefaultDomain_0&hash=item484fad4964

Even though these are 5 volts.   Power the module with 5 volts, and the 3.3 volts from the GPIO is plenty enough to activate the relay.

I use a slightly modified version of squeezelite to toggle the relay based on the state of the player.
Title: Re: picore and python
Post by: lykkedk on September 26, 2014, 06:07:24 PM
Paul.

Care to share the details..

The determination of player statement, toggle a relay sounds very interesting!

Jesper.
Title: Re: picore and python
Post by: Silver1omo on September 27, 2014, 01:50:37 AM
I found a LMS plugin that executes scripts on the LMS server based on player status/events, squeezedvera.
So I "press" the power button on the squeezebox app and squezzedvera executes a shell script in LMS that opens a CGI page (wget) in the RPI, that executes a python script and I have GPIO control!
So now I just need to get and wire the relays.

There should be a lot of cleaner options, but this seems to work nicely, I have only tested with a DMM. Off 0v, On 3.3v.
Title: Re: picore and python
Post by: Silver1omo on September 27, 2014, 10:52:18 PM
Got the parts and stuffed them in a project box. It is working  ;D
Title: Re: picore and python
Post by: lykkedk on September 28, 2014, 02:17:23 AM
Cool :)

Congrats..

Regards... Jesper

(Btw: picture perhaps? Tinypic.com
Title: Re: picore and python
Post by: Silver1omo on September 30, 2014, 09:33:16 PM
Quick and dirty:
(http://i568.photobucket.com/albums/ss128/silver1omo/Random/20140930_2022191.jpg)
(http://i568.photobucket.com/albums/ss128/silver1omo/Random/20140930_2020501.jpg)
Title: Re: picore and python
Post by: Silver1omo on September 30, 2014, 09:35:22 PM
I just use these

http://www.ebay.com/itm/5V-Four-4-Channel-Relay-Module-With-optocoupler-For-PIC-AVR-DSP-ARM-Arduino-8051-/310574401892?pt=LH_DefaultDomain_0&hash=item484fad4964

Even though these are 5 volts.   Power the module with 5 volts, and the 3.3 volts from the GPIO is plenty enough to activate the relay.

I use a slightly modified version of squeezelite to toggle the relay based on the state of the player.

I might try one of those modules. They seem popular.
Title: Re: picore and python
Post by: everglase on January 03, 2015, 05:50:26 AM
Hi Paul,

What modifications did you make to trigger a gpio based on the player state.

Jeff
Title: Re: picore and python
Post by: Paul_123 on January 03, 2015, 11:57:16 AM
Hi Paul,

What modifications did you make to trigger a gpio based on the player state.

Jeff

You will have to compile your own version of squeezelite.

take a look here.  http://forums.slimdevices.com/showthread.php?97046-Announce-Squeezelite-a-small-headless-squeezeplay-emulator-for-linux-(alsa-only)&p=736122&highlight=ampidle#post736122
 
Title: Re: picore and python
Post by: Greg Erskine on January 03, 2015, 05:30:08 PM
Hi Paul,

What modifications did you make to trigger a gpio based on the player state.

Jeff

Hi Jeff,

Here's a different way of doing it.

http://www.pinkfishmedia.net/forum/showthread.php?t=165465

It just monitors the status of the player on LMS. Its just a shell script, no extra extensions to load.

regards
Greg
Title: Re: picore and python
Post by: Paul_123 on January 03, 2015, 07:02:40 PM
Here's a different way of doing it.

http://www.pinkfishmedia.net/forum/showthread.php?t=165465

It just monitors the status of the player on LMS. Its just a shell script, no extra extensions to load.

regards
Greg

That's probably alot easier....lol.   I wrote that before I even knew about LMSCLI.   

My code also looks for a paused player.....after it is paused for so long, the relay is turned off too.  Which you can do with the LMSCLI too.