Google+ Followers

Thursday, 27 February 2014

Night time wildlife cam.

Ive been meaning to make this since the pi noir camera came out but only got round to it this week.

Firstly I needed an old pi case I could drill holes in, a small hole for the pi camera and a bigger hole for the ir pir to poke through. 

The pir is connected to positive, negative and out to gpio7 (pin26)

I then got a huge camo bag from one of my old geocaches and cut it up, one into a smaller bag to house batteries and give infra red 48 led light some protection and some material to glue around the case. I used some poly filler to waterproof the case, used a micro sd adapter to protect sd card slot.


That was the easy bit, it was the coding I struggled with, well easy to get gpio 7 to trigger and easy to save the file but I couldn't get it to save under a different name each time just the same name and then delete the file before by overwriting.  


After speaking to zac an excellent teenager programmer we started to run into other difficulties with the code before I found a snippet that I could bend and mould to this project and bingo, the files saved as date-time.h264

Here's a screenshot of the code:


So yes simple in the end,I don't have any video to put up yet but a screenshot of it detecting my finger whilst facing the small monitor I had been using.


To convert the .h264 file format to mp4 I had to do the following:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gpac

then to use it and convert the file:

MP4Box -add nameofh264file.h264 nameyouwanttocallyourconvertfile.mp4

Here is the results of the cam, about 5 seconds my dog comes into view as he wonders the house in the middle of the night.


 or linky for youtube



Coding for cam.py file:

#www.mypifi.net/blog
#code for mypifi pir wildlife cam
#please if used acknowledge me please
#by Paul Brown
import RPi.GPIO as GPIO
from time import sleep
import datetime
import os

GPIO.setmode(GPIO.BCM)
GPIO.setup(7, GPIO.IN)

while True:
  if (GPIO.input(7)==True):
    timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
    os.system ("raspivid -o /home/pi/v"+timestamp+".h264 -t 20000")
    sleep (5)


You will also need to set this file to run automatically on start up  for when you power it up in the wild.  Also a good powered usb battery, my 8000mah one lasted 24 hours and my 20000mah one dropped one bar in 24 hours, also remember to try and keep all this dry as water and electronics don't mix.

Enjoy.

Blog update, I have done more to this on my blog post: http://smstextblog.blogspot.co.uk/2014/03/wildlife-cam-part-2.html?m=1

Tuesday, 25 February 2014

Unauthorised payments by old ISP

I found out today, whilst I won't say at the moment which ISP it is (not the big five) they have been taking £35.40 a month from my credit card, a card I only ever used for their payments.

After speaking to barclaycard who immediately cancelled the card they said they would send a new card and give me details to claim against the unauthorised payments.

Now I've not noticed this card as a. It's an online card and b. it was set up to pay monthly in full however as it been paying minimuim amount I've not noticed it on my bank account when it came to barclaycard asking for minimuim amount each month. Ok my fault I should have checked to ensure or even cancel the account, but how many other people have had this done or are having this done cos they have not checked their accounts each month?

I do scan over my accounts quickly each month but things under a tenner don't seem to register with me as I mistakenly have always looked for huge amounts going in one chunk as my theory is if you doing over someone's account you get what you can in the shortest time. Even through now I'm thinking maybe small amounts infrequently would be a better way to go.

Anyhow I will see what happens and keep my 9,000 ish a month viewers up todate.

Monday, 24 February 2014

Books to help or confuse you

I've spent much of the weekend reading idiots guide to Unix which I found helpful and easy to understand. Today I'm onto my third book.  No I'm not a fast reader but it's because two books, python for dummies and python for beginners seem to have been written by someone who thinks they are writing for beginners with lots of python experience if you get what I mean.

So instead of reviewing each book I have,I've decided to list them here of the books I recommend to anyone starting out or looking to get something out of the pi.

Raspberry pi cookbook - simon monk
Get started with raspberry pi - simon monk
Python coding club - Chris roffey
Raspberry pi for secret agents - Stefan sjogelid
Raspberry pi for dummies
Raspberry pi projects - Robinson & cook
Haynes raspberry pi manual
Adventures in raspberry pi - Carrie-ann philbin
Raspberry pi user guide - upton & halfacree
Practical radpberry pi
Learn raspberry pi with linux

Ok huge list, but the list of books not to get exceed this, so to pick three to get you started I would choose:

Adventures in raspberry pi
Haynes raspberry pi manual
Raspberry pi cookbook

Enjoy.

Sunday, 23 February 2014

Truely portable pi

Whilst tidying up the attic I came across my daughters 10 year old portable DVD player that's not been used for a longtime, not since the age of Netflix and other online film channels.

So today I placed it on charge, battery still works and still plays DVD s but this is not what I want it for.  

It has a av in socket and lead (never been used) and the pi has a av socket. I've
ordered a 3.5mm to av jack so I can play sound too.

Well as I hoped it works and the screen is actually of good quality for the age and price we paid when it came out, certainly good for use with a pi and already I'm looking at some faulty ones on eBay that I could take the DVD section out and replace in its place a pi, looks like I'm onto a winner.


Wednesday, 19 February 2014

Pibow tft case with adafruit pitft

Today I got the pibow pitft case through from pimoroni a uk supplier and maker of raspberry pi cases amongst other things.

It's 10 layers of laser cut plastic which after peeling off the protective layer and building up as per instructions makes a stable well built case.

I had been up to now using the adafruit screen on a similar pi case bought cheaply off the net minus top two layers which worked fine but guessed I needed a proper case for the adafruit tft.

My pi that I used for this was being used with my weather station till I noticed this morning that the sd card socket was starting to crack, so after leaving it all day with gorilla glue carefully smeared over the sd card slot to strengthen where it was cracking it was dry tonight and ready to stick into the pibow.

The case sits securely around the sd card socket too which in my opinion will protect the slot from being broken. Although I cannot see the lights on the board itself ie boot light or internet it shouldn't really matter.

Everything sits perfectly and probably took me longer putting it carefully together than the soldering of the tft.

Certainly worth the money and looks great, the only con and maybe after pimoroni see this they might action it, a lid would be great to go over the top to protect the tft.  Maybe turning the screws around the other way and having a lid that fits on plus four more nuts or maybe I'm just going nuts? Who knows.


I also got a third set of hands from pimoroni too, it took some effort to get crocodile clips attached, but I now have a decent station to hold electronics when soldering with a nice heavy base so it doesn't move, along with excellent arms. This is certainly better than the crocodile slide bar thing that I got with my soldering iron kit which to be truthful I don't use apart from the magnifying glass occasionally.

Thanks again www.pimoroni.co.uk for stocking these two great products.


FBM2WD55NKR5

Sunday, 16 February 2014

Airpi settings

Spent a day messing about with the settings, first thing to work was in the settings.cfg after equals temp I entered minus ten and on equals humidity I placed multiplied by two, again this seem to do the trick. However it would still show high at times so got a gpio extender cable and attached the pi one end and airpi the other and within minutes everything seem to settle down to correct temperture, so it looks like it doesn't like the pi close to it and is probably the heat off the pi that is causing the issues.

Here is the link for current weather info from it https://xively.com/feeds/1002148982

Saturday, 15 February 2014

Airpi continued

Today I added the adafruit gps unit, although I have not added any files to run the gps, the red light on it blinks, a good sign.


Later after this picture was taken I decided to stand the temperature gauge up wards away from the board as it was registering 10c higher than actual temperature.

Next up was to make a container so it doesn't get wet, using four corks, gorilla glue and a Stanley knife I made this.


And currently it's sat outside with a usb battery pack and wifi connection, I'm hoping next to sort the temperature problem out.


The link for current temp etc is https://xively.com/feeds/1002148982

If you interested in getting an airpi please visit toms site http://airpi.es

Timelapse photography with pi

After going through all my bookmarks today I found a link to a great site for setting up the pi for timelapse photography.



Sunday, 9 February 2014

AirPi weather station

I've been trying to get this little project for a while now and luckily the creator tom Hartley was going to be at Cambridge raspberry jam. 

After watching toms excellent show n tell I couldn't wait to get started so last night started.


I had to firstly solder on all the connections and resistors, the longest bit here for me was ensuring the correct resistor went in the correct spot but was done very quickly.


Changes since v1 is no uv sensor which I thought was a shame instead replaced with microphone. I'm looking yet to get another adafruit gps to add to the board so it can have true gps function ability and ideal then to take camping.


Next was to do a sudo update and upgrade before following the instructions on airpi.es using the latest version and git cloning it onto the sd card.

Once done I had to open a xively account get a user number and api code to put in the config file and then was ready to run.

I know need to find away to keep this dry and also to power it, I'm thinking a usb battery pack with solar power to charge it but will have to investigate this further.

Anyhow I will keep this blog updated should I find away, till then here is the link to weather in my house in Wantage, well till I find a better place to place it.




Cambridge raspberry jam

My day started very early I had over two hours of driving ahead of me and an extra hour added to geocache on the way and split up the journey, I was travelling to camjam.

I had done a 900 waypoint csv file for the cacheberry pi which surprisingly ran really fast and use that on the way to cambridge.  I arriving I was greeted by Michael, Wesley and a few others before helping to set up by fetching tables.

I brought along the iss above.com pi and cacheberry pi and ended up squatting on the corner or Alex's table, running both pi  s off a usb battery with one pi using wifi and the other gps, they were both still running 7 hours later.

I got to meet phenoptix who had a huge led tile set on display which read must have to me and next door was piborg with their monster pi truck which Clare had to squeeze into her poor old micra, I did offer to take it off their hands as my boot was bigger but was declined.

The big pi truck had 6 motors 3hp and an estimated speed of 30mph, it weighs around the same weight as an adult and uses piborg s latest motor controller boards which you can pre order from them.

As I worked around various stalls selling or running things including ryantech s robot board and Alex's raspi.tv hdmi tv which is kick starter funded I was amazed at how professional the prototype looked.  Only metres away was some teenagers who had designed a portable pi using green perspect and while you could see it wasn't manufactured it had the look of look made with my own caring hands. 

Hamish brought along his ups kick starter project that powers the pi with Wesley next door with his iot (Internet of things) project a twimote tweeting wii remote and thermal printer (which I neeeeed).

Another great project was the pi boat which some students had built and gave me ideas for my project I was looking at which was to build a waterproof bottle which I would chuck in the Thames and track.
There was also a scratch controlled robot and also 13 year old zac and friend with his line following robot, firstly you would never guess how young they were and secondly was how Well built it was along with all the information they had put up on the walls.

I got also to meet Carrie-Anne who had released a book for the pi and who signed my copy for me, she was just full of energy and I guessed if you sat her in front of a computer yesterday and told her you wanted the hadron atom project over in Europe reprogrammed in scratch she would have had it done.


I also met Tom Hartley the man behind airpi and excellent weather station project  and also excellent talk, he showed his passion and later on twitter tweeted his ideas for airpi mark two.


Later i was seated in front of seven segment another educational device teaching children (and adults) to program. Now I admit I cannot write a python program from scratch, but stick me in front of an already running program and I can see how it runs and what does what and one of the things with seven segment was that to edit the script.  But it wasn't the enthusiasm that struck me here, no something bigger and only raswik had achieved todate, it was the fact seven segment was very well documented with an easy to follow guide, something many projects have failed to do yet the few which have like these two will be the eventual winners.

The infamous recantha picorder was on display about the size of an old portable tape deck so slightly bigger than I expected but showed the labour of love put into it.

Charlotte had brought along her neopixel earrings which were bright, glad to had seen them, certainly makes me want to retry making my neopixels work.

There lastly was geeky Tim s badge which he hasn't blogged yet but is certainly a worthy project to attempt, whilst all week I was thinking of doing it with a oled and pi, I didn't fancy carrying it around all day, geekytim however useda small Gemma/arduino type board to achieve the same but better size and battery life.

So that was my day so many faces, people I already know from Milton Keynes raspi meet, twitter friends that I now have put names to faces and many more that I never knew before the event either face to face or online.

Thanks to Michael and Tim for putting together yet another successful event.

Thursday, 6 February 2014

ISS on a raspberry pi

This week I came across a brilliant kickstarter project looking for funding, it's the international space station alarm that will alert you to the international space station going overhead at 17000mph and about 500km away.

The space station takes around 90 minutes to orbit the earth and is the size of an American football pitch.  I was lucky to see it a few years ago camping with the Russian space cargo shuttle tailing it and was lucky to see it at dusk with it very close to the earth and directly overhead.

Since then I've always been interested in it, it certainly brightens up evenings when camping around a campfire and with many phone apps why would someone want this?



Well for one you can plug in most add ons, piglow, ledborg, blink stick and adafruit 16x2 rgb screen.  Kids will love the excitement as the lights come to life as the ISS approaches, flies over and then the lights go as the ISS disappears.

The ISS can be visible if it passes us by close to sunset or sunrise. If it's going to be visible look for the pass type of "visible". Not all passes are as good as another. If you want to see the space station you will want to find a visible pass where the ISS is predicted to be very bright. Look at the Brightness column- you want the lowest number dislayed there. A good number would be -3 or lower. That would mean the ISS is as bright or brighter than the planet Venus in the sky (which is often the brightest thing in the night time sky other than the full moon). 



So how do I get this working? First of all you need to back the kickstarter project for issabove or visit their website issabove.com 


Once downloaded and the .img installed to a sd card, plug in the pi and start up, log into it with ssh and change the config file as per instructions to your location, a name for your device, the individual login details for tweets to be sent (supplied by iss above.com), type of notification device ie ledborg, adafruit lcd and edit the tweet to what you would like it to say.

Picture shows screen as ISS goes overhead.


You might also want to edit wifi details so it can log on wirelessly to your router so it can update itself (usually once every three days will do) or just use ethernet.

The location you put into the config is good for a 50 mile radius of your location so don't worry to much if you decide to take this to work and sit it on your desk.

Once you reboot the device will come to life to let you know it's working, you can also log into it with its IP address in a web browser and view it's Webserver, details like next pass and other interesting facts are shown along with a tweet button to tweet the ISS and let the crew know what a great job they are doing.



So if you are stuck for a project idea, want something for the kids or something to take camping (this could quite happily run off a cigarette USB adapter) then this is it.

Want to see it in action? Then visit their website www.issabove.com or if you are attending the Cambridge raspberry jam this weekend I will have it with me and will be demoing it along with my cacheberry pi.


Thank you to the creator Liam for adding me to the beta program and allowing me to review this great device.



Sunday, 2 February 2014

Bitcoin mining on the pi

With bitcoin becoming more and more popular, so does its worth.  A few years ago these things were only a cent or two and a year ago worth around a few dollars, so why are they now around $1k a bit coin?

Well after silkroad the darkside of the Internet was shutdown and bitcoins that had been traded on these illegal sites been confiscated by the American government, it basically cleaned up the online crypto currency and value soared.

Now by all means a bit coin miner will still not earn you enough these days for the electric used or for equipment needed, but by next year some American financial groups claim its worth would have multiplied by 10-100x meaning each coin could be worth up to $100k

I started mining a few months ago with the raspberry pi and a program called minepeon which can fit onto a 2gb sd card. I used a usb 333m/h usb miner and took me two months using slush's pool to mine $10 

Now luckily my pi and one usb was only using no more than 10 watts of power so about 80p in that time frame but still not enough to pay for itself.

I also use a mining pool as some days you can have a couple of finds to others up to 20 finds and all this is split between the pool by the amount of work you do.  I decided that all through I couldn't afford $10k 1t/hs miner that could recoup my money in less than a month, I could make use of other peoples by buying second hand off eBay.

First warning of doing it this way you could be sold a broken unit, second warning check their feedback and that they have 500 positive feedback.  Many scammers have decided to join eBay and make a dozen low price buys with known Chinese members who automatically give up positive feedback, not paid them but have now got some positive feedback to look good.

Lastly only pay through eBay and PayPal, I had one guy pull a fast one but luckily I was protected through pay pals protection scheme and soon got my money back.

So now I have a 10g/hs set up, a 333m/h usb miner, a tempromental 2.5g/hs usb miner and a butterfly labs jalapeno that works to 7.5g/hs totally around 10.4g/hs on a good day. The jalapeƱo has had its case removed to allow more air to get to it keeping it around 30c which is around 15c lower than with case on and slightly more quiet.

It's now using in total around 50 watts of power equating to around $15 of electric a month and earning $40-100 dollars a month before knocking off the electric, current bitcoin value and return of investment. I see on a good run it could be as early as six months but in reality it could be longer at least up to two years.

However I'm not in this for a quick buck but a long term investment if i do make enough to buy a state of the art mining machine capable of earning me my weekly wages in a day then it will bea different matter and possibly one to change my life around.

If you enjoyed this article, please click an ad or donate a bit of bitcoin:  

1NxgjnWQfS7YXBe7M4ztuTn4Mw91UGTkBD


Saturday, 1 February 2014

Fish Dish Pi from Pi Supply

Ive managed to sit down and try out this simple but efficient add on, three leds, a button and a buzzer.


I needed to figure out the pins so used Daniel Bulls excellent berryio which is web based so all you need to do is type in the internal IP address, type ifconfig on terminal window of pi and go to a web browser on any computer, type pi IP address in the web box and up should come the berryio screen.


This was brilliant as I could check each gpio for input or output and soon found all I needed, being:

Red = gpio 9
Amber = gpio 22
Green = gpio 4
Buzzer = gpio 8
Button = gpio 7

First script manages the button to control the leds:

#!/usr/bin/python

# press button to light leds.
# http://www.mypifi.net/blog


# Import required libraries
import RPi.GPIO as GPIO
import time

# Tell GPIO library to use GPIO references
GPIO.setmode(GPIO.BCM)

print "Setup GPIO pins"

# Set LED GPIO pins as outputs
GPIO.setup(9 , GPIO.OUT)
GPIO.setup(22, GPIO.OUT)
GPIO.setup(4 , GPIO.OUT)

# Set Switches GPIO as input
GPIO.setup(7 , GPIO.IN)

print "Press the button"

try:

  # Loop until users quits with CTRL-C
  while True :

    # Turn off LEDs
    GPIO.output(9 , False)
    GPIO.output(22, False)
    GPIO.output(4 , False)
   
    if GPIO.input(7)==1:
      print "  Button pressed!"
        
      # Turn off LEDs
      GPIO.output(9 , False)
      GPIO.output(22, False)
      GPIO.output(4 , False)
        
      # Turn on LEDs in sequence
      GPIO.output(9 , True)
      time.sleep(1)
      GPIO.output(22, True)
      time.sleep(1)
      GPIO.output(4 , True)
      time.sleep(1)
      
      # Wait 2 seconds
      time.sleep(3)
      
      print "Press a button (CTRL-C to exit)"
      
except KeyboardInterrupt:
  # Reset GPIO settings
  GPIO.cleanup()


Next up a switch test python script

#!/usr/bin/python

# switch script
# http://www.mypifi.net/blog


# Import required libraries
import RPi.GPIO as GPIO
import time

# Tell GPIO library to use GPIO references
GPIO.setmode(GPIO.BCM)

print "Setup GPIO pin as input/output"

# Set Switches GPIO as input
GPIO.setup(7 , GPIO.IN)

print "Press button"

try:

  # Loop until users quits with CTRL-C
  while True :
   
    if GPIO.input(7)==1:
      print "  fishdish button has been activated!"
      time.sleep(0.5)
      print "Press a button (CTRL-C to exit)"
      
except KeyboardInterrupt:
  # Reset GPIO settings
  GPIO.cleanup()


Then i wanted some noise, this was quick:

#!/usr/bin/python

# test buzzer
# http://www.mypifi.net/blog

# Import required libraries
import RPi.GPIO as GPIO
import time

# Tell GPIO library to use GPIO references
GPIO.setmode(GPIO.BCM)

# Configure GPIO8 as an outout
GPIO.setup(8, GPIO.OUT)

# Turn Buzzer off
GPIO.output(8, False)

# Turn Buzzer on
GPIO.output(8, True)

# Wait 1 second
time.sleep(1)

# Turn Buzzer off
GPIO.output(8, False)

# Wait 1 second
time.sleep(1)

# Turn Buzzer on
GPIO.output(8, True)

# Wait 1 second
time.sleep(1)

# Turn Buzzer off
GPIO.output(8, False)

raw_input('Can you hear the buzzer? press enter to exit')

# Reset GPIO settings
GPIO.cleanup()


Ive also made a LED test script

#!/usr/bin/python

# This script lights all 3 LEDs, a good test script
# http://www.mypifi.net


# Import required libraries
import RPi.GPIO as GPIO
import time

# Tell GPIO library to use GPIO references
GPIO.setmode(GPIO.BCM)

# List of LED GPIO numbers
LedSeq = [9,22,4]

# Set up the GPIO pins as outputs and set False
print "Setup LED pins as outputs"
for x in range(3):
    GPIO.setup(LedSeq[x], GPIO.OUT)
    GPIO.output(LedSeq[x], False)

# Light all the leds
for x in range(3):
    GPIO.output(LedSeq[x], True)    
    time.sleep(0.2)

raw_input('All leds should now be lit, press enter to exit program')

# Reset GPIO settings
GPIO.cleanup()

Lastly make the lights randomly light up, you could incorporate it to include the buzzer.

#!/usr/bin/python

# Random LED lights
# http://www.mypifi.net/blog

# Import required libraries
import RPi.GPIO as GPIO
import time
import random

# Tell GPIO library to use GPIO references
GPIO.setmode(GPIO.BCM)

# List of LED GPIO numbers
LedSeq = [9,22,4]

# Set up the GPIO pins as outputs and set False
print "Setup LED pins as outputs"
for x in range(3):
  GPIO.setup(LedSeq[x], GPIO.OUT)
  GPIO.output(LedSeq[x], False)

# Seed the random number generator
random.seed()

try:

  # Loop until users quits with CTRL-C
  while True :
     
    # Turn off all 3 LEDs
    for x in range(3):
      GPIO.output(LedSeq[x], False)      
      
    # Generate random number between 0 and 2
    result = random.randint(0,2)
    print "Turn on LED : " + str(result)
    # Turn LED number X  
    GPIO.output(LedSeq[result], True)  

    # Wait
    time.sleep(0.5)
      
except KeyboardInterrupt:
  # Reset GPIO settings
  GPIO.cleanup()

If you want one, then please head over to http://www.pi-supply.com/product/fish-dish-raspberry-pi-led-buzzer-board/ to order for £9 dont forget to mention finding out about it here.

The other great thing with this add on is the extended gpio s so you could add on extra modules or incorporate it into other projects, thanks for reading I hope you enjoy this as much as me trying it.