akame
Posts: 8
Joined: Sat Mar 21, 2015 4:44 pm
Location: Lincolnshire UK

Water Drop Photography

Sat Mar 21, 2015 4:55 pm

Hi

Not sure whether anyone has tried this, but I have done the coding for the water drop project in the latest Magpi issue (31).

I have installed the wiringpi as per the instructions at www.wiringpi.com and typed out exactly the coding. However, when I run it it falls over on the import wiringpi. It doesn't matter whether it is wiringpi2, wiringPi, wiringpi or what. It just says no module named wiringpi (or whatever). I have tried adding a header #include <wiringpi.h> but that doesn't help. On comment on Mr Hunt's web page says to use GitHub but another website said not to. Confused. If I run gpio readall it seems installed.

Can anyone advise where I'm going wrong please? This is my first project (yes, a bit ambitious!) but I don't want to spend £180 for a proper water drop set up and I want to learn coding and having fun with the Pi. Have yet to build the circuit (getting some help there too).

My Pi is the model B with 512Mb RAM.

Many thanks

User avatar
DougieLawson
Posts: 41966
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Water Drop Photography

Sat Mar 21, 2015 7:52 pm

It's a case sensitive name small w capital P.

root@raspberry ~ # cd /usr/local/lib
root@raspberry /usr/local/lib # ls *iring*
libwiringPiDev.so libwiringPiDev.so.2.24 libwiringPi.so libwiringPi.so.2.24
root@raspberry /usr/local/lib # cd ../include
root@raspberry /usr/local/include # ls *iring*
wiringPi.h wiringPiI2C.h wiringPiSPI.h wiringSerial.h wiringShift.h
root@raspberry /usr/local/include #
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on Twitter/LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

akame
Posts: 8
Joined: Sat Mar 21, 2015 4:44 pm
Location: Lincolnshire UK

Re: Water Drop Photography

Mon Mar 23, 2015 8:27 pm

Thank you. I shall try this and let you know.

akame
Posts: 8
Joined: Sat Mar 21, 2015 4:44 pm
Location: Lincolnshire UK

Re: Water Drop Photography

Mon Mar 30, 2015 1:27 pm

Sorry, I'm obviously being very thick. I cannot change into the root@raspberry ~ directory. I'm a total noobie at this, but I cannot seem to make anything of it. Oh, bring back the Amiga!! :)

I think I'm missing something pretty basic commands to get wiringPi started. It's just knowing how. :(

When I've tried to type your info, the first line is fine. After that I get get /usr/local/lib is a directory.

Many thanks
Last edited by akame on Mon Mar 30, 2015 2:08 pm, edited 1 time in total.

akame
Posts: 8
Joined: Sat Mar 21, 2015 4:44 pm
Location: Lincolnshire UK

Re: Water Drop Photography

Mon Mar 30, 2015 1:55 pm

This is the code:


import wiringPi
from time import sleep

gpio = wiringpi.GPIO(wiringpi.GPIO.WPI_MODE_GPIO)
shutterpin = 17
solenoidpin = 18
gpio.pinMode(shutterpin,gpio.OUTPUT)
gpio.pinMode(solenoidpin,gpio.OUTPUT)
wiringpi.pinMode(shutterpin,1)
wiringpi.pinMode(solenoidpin,1)


gpio.digitalWrite(solenoidpin,gpio.HIGH)
sleep(0.06)
gpio.digitalWrite(solenoidpin,gpio.LOW)

sleep(0.1)

gpio.digitalWrite(solenoidpin,gpio.HIGH)
sleep(0.05)
gpio.digitalWrite(solenoidpin,gpio.LOW)

sleep(0.12)
gpio.digitalWrite(shutterpin,gpio.HIGH)
sleep(0.1)
gpio.digitalWrite(shutterpin,gpio.LOW)


I've read on various other posts that I need

#include <wiringPi.h>

I've tried this. All I keep getting is that there is no module called wiringPi. I've followed all the instructions to get it to install wiringPi and it seems to be there.

Any help gratefully received, but please note I'm very much a beginner so please put any instructions clearly!!

Thanks

jonnyni
Posts: 3
Joined: Mon Mar 30, 2015 6:24 pm

Re: Water Drop Photography

Mon Mar 30, 2015 6:32 pm

I'm also completely new to this and I used dave's water drop setup as my first project. I have it working ok but struggling to get collisions so still work in progress.

As for the problems you are having did you install wiringpi or wiringpi2 ? I only ask as I am using wiringpi2 so all I have been doing is changing the import line to -

Code: Select all

import wiringpi2 as wiringpi
Don't know if this will be of any help but thought I'd mention it anyway.

Jonny

akame
Posts: 8
Joined: Sat Mar 21, 2015 4:44 pm
Location: Lincolnshire UK

Re: Water Drop Photography

Tue Mar 31, 2015 9:41 am

Thank you Bertwert - I will try that, although it says the problem is with the import line.

Jonnyni - I installed wiringPi from www.wiringpi.com. I cannot see on there any mention of wiringPi2. Where would I find this please? I'm getting this completely around my neck.

This is my first project too. I think my Raspberry Pi may be able to fly soon but it won't need coding. Just an open window!!

Thanks

User avatar
DougieLawson
Posts: 41966
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Water Drop Photography

Tue Mar 31, 2015 10:10 am

WiringPi2 is a python wrapper round WiringPi.
sudo pip install -U wiringpi2
should get a good version.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on Twitter/LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

jonnyni
Posts: 3
Joined: Mon Mar 30, 2015 6:24 pm

Re: Water Drop Photography

Tue Mar 31, 2015 10:38 am

This was what I used.

http://raspi.tv/how-to-install-wiringpi ... spberry-pi

One of my results

ImageWater Dtrop by jonny.andrews65, on Flickr

jonnyni
Posts: 3
Joined: Mon Mar 30, 2015 6:24 pm

Re: Water Drop Photography

Wed Apr 01, 2015 1:26 pm

Thanks but all down to Mr Hunts setup. :D

akame
Posts: 8
Joined: Sat Mar 21, 2015 4:44 pm
Location: Lincolnshire UK

Re: Water Drop Photography

Wed Apr 01, 2015 3:25 pm

Thank you all. Nice photos guys.

The link was brilliant Jonnyni. I feel I'm starting to make headway at long last. Just falls over on the:

sudo pip install wiringpi2

I'm getting:

Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement wiringpi2
No distributions at all found for wiringpi2

I guess maybe site is down :-(

akame
Posts: 8
Joined: Sat Mar 21, 2015 4:44 pm
Location: Lincolnshire UK

Re: Water Drop Photography

Wed Apr 01, 2015 3:55 pm

Hi Bertwert - about 10 mins ago! I'll have another go later. Thanks for the link - all helps to have a backup plan I reckon.

I will get this working. I WILL!

Thanks

Lance Ford Jones
Posts: 1
Joined: Thu Apr 02, 2015 9:26 pm

Re: Water Drop Photography

Thu Apr 02, 2015 9:36 pm

Could someone who has gotten the code (and the whole package) working please post their code.

I'm having issues with the "wiringpi2 / wiringpi / wiringPi" thing.

Specifically the import line is: "import wiringpi2" but then this line "gpio = wiringpi.GPIO(wiringpi.GPIO.WPI_MODE_GPIO)" refers to "wiringpi". Won't work even if I make them agree. The "import wiringpi2" is successful (but only in Python 2) but then the "gpio = ..." line breaks. Thanks.

Edit:

Just found this:
http://www.davidhunt.ie/water-droplet-p ... pberry-pi/

He posted this same project to his own site in January of 2013. Some additional useful information about building it.

Take a look at the code. He imports "wiringpi" not "wiringpi2". Otherwise the code looks the same.

akame
Posts: 8
Joined: Sat Mar 21, 2015 4:44 pm
Location: Lincolnshire UK

Re: Water Drop Photography

Fri Apr 03, 2015 7:52 am

Hi Lance

I agree - it is totally confusing. I THINK I've got it to work. At least it runs through with no errors. I installed wiringpi2, and then changed all instances of wiringpi to wiringpi2. I also installed wiringpi (I have no idea if you need both). It will now run through without issue. Only when I connect the circuit and solenoid will I know for sure, but I think there is light at the end of the tunnel.

My code is above but I changed all wiringpi to wiringpi2 if that helps.

Good luck.

texy
Forum Moderator
Forum Moderator
Posts: 5171
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Water Drop Photography

Wed Apr 22, 2015 1:50 pm

Hi,
there is of course no real reason to use wiringpi (or wiringpi 2) when RPi.GPIO will work perfectly well for this project and is pre-installed in Raspbian.
You'll need to modify the python program of course, but that in itself is a useful learning exercise.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Return to “Python”