Google+ Followers

Wednesday, 19 April 2017

The Annoying Pi


Are practical jokes your forte ? Then this will be right up your street and can be built for around £20 of which probably be a lot less as you will no doubt have these bits already lying around.

So lets get started this is what you need:

Pizero w
Speakerphat
Usb powerbank to power it.

After following the instructions on Pimoroni the makers of speakerphat and the installation of the phat to the pi you will need to do a few things. First is to log on to wifi, there is enough tutorials should you need to ask how to do that.  Next is to search for "annoying .wav" you should find quite a few sites and from here download the files.  I found that renaming the files to something shorter like buzz.wav or scream.wav will make things easier later on.

Next open a command line and go to raspi-config and enable ssh.  It will also be a good time to change any default password so no one else can ssh into your pi.

Once done shutdown the pi, attach battery pack to pi and hide somewhere like under the bed or even back of a cupboard.

Now fire up another pi or computer and start up terminal.

Here we can use nmap to search for all connected devices on our network and get the ip address of the annoying pi or if before you shutdown the pi you do an ifconfig and write down the ip address on the wlan0 line.

Next we need to ssh in and the command will be like this:

sudo ssh pi@192.168.1.5

Pi will be the user name and 192.168.1.5 (will be whatever your device has allocated to it) the ip address.

Next it will ask for password and if correct will go on to ask you further questions of which just reply yes.

Now we are logged in to the pi we can have some fun. Start by logging into the folder the .Wav files are stored in and most likely be Downloads with cd Downloads command.  Here with the ls command we can see all the files.  Next is to launch the files, you could write a random playing script with python but i dont think you will get the element of surprise to what we want.

The next task is to start the sounds, this will be done with the following command with my scream.wav file.

Sudo aplay scream.wav

Now if all has gone well you should be hearing the file being played.  When you have done this with a few files you will be able to choose the files quicker at the command line by pressing the up arrow to go through previous commands and choose the file if previously played quicker.


Have fun and feel free to post any extra tips below.

Tuesday, 7 March 2017

Raspberry Pi Wedding Twitter selfie camera

I wanted to do something for my wedding to my wonderful wife that was different.  We had already planned a non traditional wedding with lots of different things, but I also wanted something that would be seen as trendy amongst the cool kids.

My daughter told me about a photo booth company but with such a small budget we couldnt afford one then I remembered something similar had been done and after a few googles I found tons of similar ideas but all seem to use Twython and from what I read parts had been depreciated yet I couldnt find the right commands to actually make it work.

So with the latest Raspberry PiZeroW and offical case, old pi camera from another project I began my project.  I had to enable ssh and vnc, personally I prefer sshing in to deal with issues but vnc can be better for trouble shooting.

I then had to make a twitter account (@angelapawedding) and set up the api so i could get the access and consumer tokens and set to read write and got to work, even soldering two pins on the back to 3rd and 4th pin in on the top row to attach a two wire pc wire/button reset switch to.  I figured this way if kids dropped or pulled it at least it could be reconnected with ease.


here is the code:
-----------------------------------------------------------------------------------

#mypifi feel free to use
#!/usr/bin/env python2.7
import tweepy
import sys
from picamera import PiCamera
from time import sleep
from datetime import datetime
from gpiozero import Button

consumer_key        = 'goes here'
consumer_secret     = 'goes here'
access_token        = 'access token code goes here'
access_token_secret = 'access secret goes here'
button = Button(14)
camera = PiCamera()
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)

while True:
    button.wait_for_press()
    status = "#LobsterWedding"
    timestamp = datetime.now().isoformat()
    photo_path = '/home/pi/wedding/photo/%s.jpg' % timestamp
    sleep(3)
    camera.capture(photo_path)

    with open(photo_path, 'rb') as photo:
        api.update_with_media(photo_path, status=status)


-------------------------------------------------------------------

The status part of the code is what text you want to display with the picture I used a hashtag so it be easy for people to find pictures or even add theirs for the wedding.  If you are interested, lobsters are supposedly meant to mate and be loyal to the same partner for life.

photo_path is where the picture is stored in my case its stored in folder called wedding in another folder within called photo.  each file saved here is given a unique filename and the program then tweets the latest picture using the twitter api via tweepy.

I saved the file as camera.py and chmod +x the file.  Once in place I vnc'd into it opened up a terminal and ran camera.py and then left it.

So throughout the evening guests (and especially the younger ones) had something to do and even my selfie obsessed daughter had a go as you will see below.  Guests could look up what had been tweeted by the camera at @angelapawedding or by searching the hashtag #lobsterwedding.



Sure the code could be cleaned up a bit more and more could be done with it, but for a quick project between finalising the final parts of the wedding I thought it was pretty good and was also a good talking point to guests.

If you do find a way of tidying up code then feel free to comment below and I will add it to the blog.

Wednesday, 22 June 2016

raspberry pi news ticker

Ive been trying to do more with the max7219 for a while. Whilst playing with an 8x8 square can get you started a 16x8 gets fun but addictive.

Last week i got a 32x8 board through which is basically 4x 8x8 matrixes still not happy i ordered another that arrived today and soldered the two together so i have 8x 8x8 matrixes and with editing led.matrix() from 4 to 8 it worked.




The wiring was a case of wiring vcc to 3.3v. ground to ground. Din to pi pin 19. Cs to pin 24 and the last one clk to 23.

With the help my last post and rmhull s github code for the 7219 chip i was soon running various code.  Next was to get a news ticker working and after a search i found feedparser a python module which can be installed with apt-get python-feedparser.

Running into a bit of difficulty i turned to twitter with what i had coded so far and help from @rgee0 aka richard gee we got there in getting a news ticker on screen.

Next was to merge the two codes and bingo worked on first attempt


Here is my newsticker in action.




There we go feel free to add and change the code and comment below.

Monday, 13 June 2016

Keyes 16x8 led matrix add on board

I bought one of these keys 16x8 led boards a while back but couldnt get it working. Well a lie i couldnt get both screens working.

So tonight whilst looking for something different I found this board and decided to give it another try. On googling i kept finding arduino set ups which wasnt what i wanted and after using git clone https://github.com/rm-hull/max7219.git i searched for projects which used mr hulls code and came across one which pointed me to another github repo.

So here we go:

First enable SPI in sudo raspi-config (look in advanced menu)

next type:

sudo git clone https://github.com/leon-anavi/raspberrypi-matrix-led-max7219

cd raspberrypi-matrix-led-max7219

sudo python setup.py install

There we go. Some good example codes there and after some playing around i managed to get it to display the time.

.



Sunday, 29 May 2016

Reintroduction to caching

After the passing of my beloved dog Frodo a couple of weeks ago I decided to brush the cobwebs off my basic looking mountain bike that I had been given a while back and decided to take it for a ride and do a few geocaches as a carrot to the donkey to ensure i didnt give up to quick.  First thing i noticed was I lost my pen. after trying to sign in with a dirty stick I managed to find a waxy crayon in the puncture repair kit and decided this was my pen for the day.

It was nice to get back into the countryside and felt weird as this was where me and Frodo had come many times, but in recent years we had gone from unlimited miles per walk, to 10, then 6, down to 3 then less than a mile.

I was disappointed to the fact there were not any traditional size caches just tiny boring micros.

I had been for a while playing Ingress another location game but after being caught up in a widespread ban for allegedly breaking TOS which to this date I still dont have a clue but it be something to do with travelling to fast between locations or something stupid to which i have lodged a appeal as reaching level 14 without cheating and playing within the rules feels like an insult.  The other option would be to start all over again and work my way back up and with what i know these days it would take long, but still why should I after the way they have treated me in this mass world wide ban sweep that took place last week.  Ive heard that those that appeal have a very low chance of having their accounts reinstated so who knows I should hopefully be one of those.

But on a huge positive I thought about my raspberry pi geocaching device. It was made with a pi model b. now thinking about it I could remake it as a wrist band device with a pi zero and a long lead to a battery pack in my bike bag and have a new gps system. maybe i will work on this idea next.

Tuesday, 15 December 2015

Lightshowpi

This is another project ive been preparing for christmas.  Ive started small to see how i get on with 2x 20 led 3v lights from the local pound shop and a 3v EL wire again cheap so if it doesnt work ive not lost.

After putting jessie raspbian onto the card and set up the configs i downloaded the lightshowpi software before wiring up the lights to a relay board. I didnt run into any problems as the lightshowpi site is well written.  The only problem i did notice was my relay board being noisy but im hoping by getting a solid state relay board this will solve it.

Here is a link to the youtube video i made.

https://youtu.be/nl5m43lxC2g

Wednesday, 9 December 2015

MyPiFi Cheerlight Christmas Decor



I decided a while back that after doing my Christmas tree last year in NeoPixel lights http://www.youtube.com/watch?v=uoGk0M8YdMA and using Penguin Tutors excellent DJ lights program https://github.com/penguintutor/neopixel-gui that this year I wanted a Cheerlight item (cheerlights.com) like I had run on the Unicorn Hat by ForToffee https://github.com/ForToffee/UnicornHAT Cheerlights is an internet of things where people use twitter and the hashtag #cheerlights and a colour and all items running cheerlights around the world will change colour to the current tweeted colour.

So the hunt was on for something I could use and low and behold I came across this laser cut house that had a battery pack running some plain leds inside.  Once it arrived it was time to strip out the lights and add 13 neopixels inside on a long strip, but to be able to get inside i needed to use a craft knife to carefully remove the roofs and one building.



I originally tried neopixel buttons but everytime i had these in place a wire would snap so from 5 buttons the amount of pixels would go up.

Once in place I soldered the pixels to a MyPiFi neopixel controller board and attached to one of my pi's http://smstextblog.blogspot.com/2015/03/afirstly-thank-you-for-purchasing-this.html .  I then glued everything back together and then followed Tonys great NeoPixel how to guide off of adafruit https://learn.adafruit.com/neopixels-on-raspberry-pi/overview Once all the software was in place I ran the first test and all seemed fine it worked.  However when I tried to run the Cheerlight code from David Bradway https://github.com/davidbradway/cheerlights I just couldnt get it to work.  I asked about and was told two different things to try so tried both at the same time, the first was to use an old pi with 26 pin header and second was to use Raspbian Wheezy and not Jessie which I tried and bingo, it worked I couldnt believe it.



I have since glued the Pi and the display to some thin mdf word to keep it all together and stop the wires being pulled and this is the finished result.




There is still some coding bits to fiddle around with but apart from that this is now ready for the christmas festivities and perhaps after christmas i could remove the christmasy figures off the front and just have this as an everyday cheerlight display for my desk.

Thank you for reading and please share.

Wednesday, 18 March 2015

ingress the new geocaching game?

As many of you know I use to be a avid cacher, hitting the top 50 finders at one point, first to find 100 5/5 extreme caches and always one looking for quality over quantity. However after a run in with a local reviewer over a number of things that I personally still stand for and the politics that came about, I like many just gave up.  I've not renewed my membership, i rarely look for caches andvi believe I still have caches found on my GPS that I can't be bothered to log yet, so why?

Well its why everyone is moving over to ingress, no more travelling hundreds of miles to get a smiley, getting ivy rash from searching through ivy for a micro or searching through rubbish in a layby for a watersoaked logbook that's seen better days.

I tried munzees in the summer and was bored rather quickly, scanning barcodes and quite often some that were rather weathered and wouldn't scan I needed something better, remembering that a friend had shown me an app last year but was only available for android at the time (now on iPhone too) I decided to give this new game ago.

Its called ingress, its about battling blue team (the best) versus greens (the enemy), you pick a side and that becomes your fraction.  The idea is to take over portals which are places of interest and of which scores you points and linking them to other portals which can be captured and recaptured many times a day in busy spots. Portals are normally submitted to show places a visitor might not go, a work of art, sculpture, area of interest or historic value.  I for one have discovered new things locally as well as visited things I've forgotten and so far other players have been great with advice and support and best of all its free.

So it looks like I've discovered a new way to pass my time and enjoy what's around me without spending loads on petrol travelling to my nearest cache. Take a look and let me know what you think.

Monday, 2 March 2015

Neopixel assembly guide and links

Firstly thank you for purchasing this board, if you have children assembling this then adult supervision will be required along with an explanation of the dangers of electrical voltage.

While I recommend a 5v 4amp power supply from CPC.co.UK you can use an outdoor lights 5v 4amp supply.

Here is what you should have to start with:

1x gpio header
1x PCB board with chip already on board
3x terminal screws



The chip should already be on the board as it was the best way for posting them, they haven't been soldered but can be although it should work how it is, please ensure the dimple is at bottom as per pic.

Using any method you have to hold board in place start by soldering the gpio header being careful not to melt the chip.



Next solder on the screw terminals ensuring they are the correct way as per picture.



When finished the board should look like this.

 Next use either the power supply from my original Xmas neopixel post or the recommended 5v 4amp one from CPC.co.UK


Cutting the end off use a multimeter to figure out the wires, on mine the wire with the line down it was positive and the plain black was negative. Strip the ends just enough to screw into the plus and negative connection on the board and place some electrical tape around each wire so if they get pulled to hard or come out they won't short or be exposed. It can be a tight fit so cutting some of the bare wire off might be needed. If attaching a outside light power supply then two good bits of wire will do after you have checked the output and adjusted it with the pot terminal on the unit and a multimeter.





Once done screw the neopixel power to the positive and negative on the board screw terminal called neo. Next screw in the data lead to the screw terminal called data. The NC stands for not connected and does nothing.

Now you are ready to program it. Please look at my Xmas neo lights blog link for more details on coding and demo code.


As usual info and links can be found on my kickstarter 

Saturday, 21 February 2015

Energenie infrared remote controlled socket


I got one of these the other week and have been testing it.

It's a kit of an infra red add on board and infra red socket. The socket can be programmed to be turned on or off with any remote control and was so easy that my elderly anti technology mother was able to work it and ideal for her to turn on/off her heater or whatever else you want to use the socket for.  Also with the long lead the socket can be placed out of reach, but the infra red part can be stuck with the enclosed sticky pad somewhere in sight of the remote control.

Although I'm struggling to get my infra red add on board to work, I did try the demo one at a recent show at betts 2015 and was spot on. Would I get one erm ok, but if can I pick my automation gear I would go for the radio sockets as they can be hidden but only controlled with the supplied remote or add on board where as this any remote control or this add on board.