User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Tue Nov 27, 2012 10:51 pm

sundancer wrote:It would be really cool if you could maintain your code on github.com for example so whenever one needs to download your code he/she would always get latest version from github url. That way people can follow and clone your project to fit their specific needs. Even contributions can be made and it would be easy for you to merge them into your project.
I agree, it would. That probably might be the way to go. Thanks for the suggestion. Did you have any joy with wget now I've fixed it?
Alex Eames RasPi.TV, RasP.iO

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Wed Dec 12, 2012 11:25 pm

As some of you will have seen in another thread today, I've been working on trying to figure out spi in python to talk to the ADC and DAC. I was struggling through the datasheets to try and modify some code I'd found yesterday for a similar but different ADC (MCP3008), but then happened on a bit of code that gave me exactly what I needed to talk spi with the MCP3002. That made things much easier. I don't know who to credit because it was an anonymous post on pastebin. But the code works a treat and I've now incorporated it into what I think is a perfect clone of the original atod program (I introduced a 20 Hz sampling limit to enable headless operation without buffering, I also gave it a time limit of 30s to run).

So I've just pushed out a new release including the new atod.py file and a new version of leds-rg.py which uses the built-into RPi.GPIO revision checker.

You can download the new files at...
http://raspi.tv/downloads

The atod program needs spi to be enabled and py-spidev installed. Full instructions in the README - it's
a trivially easy install.

Please try these out and let me know how you get on. :D

Just dtoa and dad to go :lol:
Alex Eames RasPi.TV, RasP.iO

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Thu Dec 13, 2012 11:50 am

I've just pushed out yet another new release including the new dtoa.py file which I've written this morning. This time there was no rescue of code snippets on the web :cry: . So I had to do the grown-up thing and work it out from the data sheet. Fortunately, I was able to figure it out with reference to the previous SPI python stuff I'd recently done and a bit of educated guessing about how spidev works (and a web-based binary converter :D )

You can download the new files at the usual place...
http://raspi.tv/downloads

The dtoa program needs spi to be enabled and py-spidev installed. Full instructions in the README - it's
a trivially easy install.

Please try these out and let me know how you get on. :D

We are nearly complete :)
Just dad to go now, but having worked out the SPI bit I hope that will be easier (although that's not a given, since we'll have both SPI channels in use simultaneously). We'll see :lol:
Alex Eames RasPi.TV, RasP.iO

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Fri Dec 14, 2012 5:20 pm

We are now complete. dad.py has now joined the rest of the family :lol:

http://raspi.tv/downloads

Download, play, report back with any issues (or kind words if you feel so inclined).

Again, functionally identical to the C version, but because py-spidev uses denary (and not hex like the C version) column 1 shows the denary (0-255) numbers sent to the DAC. It would be horribly confusing if I converted them to hex, when the program doesn't actually use it. :lol:

So. Job done. Very satisfied to have finished it. When I started out, I wasn't sure I'd be able to do them all. And last night I found myself writing a python driver for the mcp4802 DAC :o
Alex Eames RasPi.TV, RasP.iO

Myra
Posts: 13
Joined: Fri Jan 06, 2012 3:14 pm

Re: Gertboard Software in Python - Released

Sat Dec 15, 2012 7:32 am

This is amazingly good work.

I wrote most of the user manual for the Gertboard. Gert has asked me to update it for the new already-assembled Gertboard that will go on sale in the new year. I would like to put in a pointer to the Python code because I think Python will be more accessible to people who are relatively new to programming.

I won't have huge amounts of time. I have a regular job now so I will be doing this in the evenings, but at the very least I can tell people about the Python code and point them to the right place to download it. So unless you say otherwise, I will just include the links that you have posted here along with some appreciative text.

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Sat Dec 15, 2012 3:37 pm

Myra wrote:This is amazingly good work.
Thank you :D
Myra wrote:I wrote most of the user manual for the Gertboard.
Well done. I thought the manual was excellent :)
Myra wrote:Gert has asked me to update it for the new already-assembled Gertboard that will go on sale in the new year. I would like to put in a pointer to the Python code because I think Python will be more accessible to people who are relatively new to programming.
I think that's true. C still seems a bit daunting to me, whereas Python seems a lot more "natural" (to me at least). I started dabbling in Python earlier this year. But I have used BASIC, REXX and PERL before, with PERL being the most recent - and the closest to Python.
Myra wrote:I won't have huge amounts of time. I have a regular job now so I will be doing this in the evenings, but at the very least I can tell people about the Python code and point them to the right place to download it. So unless you say otherwise, I will just include the links that you have posted here along with some appreciative text.
I'm fine with that Myra. I've also been talking to Gert about this, and maybe between the three of us we can work out what to include regarding the Python programs. I'm happy to have some input from the Python side of things, if that's useful. :)
Alex Eames RasPi.TV, RasP.iO

nr.
Posts: 144
Joined: Wed Oct 03, 2012 8:51 am
Location: The Fens
Contact: Website

Re: Gertboard Software in Python - Released

Mon Dec 17, 2012 12:09 pm

Myra wrote:This is amazingly good work.

I wrote most of the user manual for the Gertboard. Gert has asked me to update it for the new already-assembled Gertboard that will go on sale in the new year. I would like to put in a pointer to the Python code because I think Python will be more accessible to people who are relatively new to programming.
Would it also be useful to have something in BASIC for RISC OS ? I've been doing some playing, and it seems like a nice project to get my teeth into - there's already a thread somewhere here for this subject. If it's useful, I'll tidy up the code and continue with it. If not, well, I'll probably continue with it anyway, just not tidy the code so much :)

Ta,
--
nr.

webbwbs
Posts: 2
Joined: Fri Nov 02, 2012 9:13 pm

Re: Gertboard Software in Python - Released

Wed Dec 19, 2012 12:16 pm

alexeames wrote:Well there's been over 100 downloads of the Python Gertboard software so far. I wonder if anybody else apart from the one or two I've heard from has had a chance to try any of the programs yet?
I have now had time to complete the build of my Gert Board and have had a go with your software. I was very please with the results. I've only used the leds program at the moment but I will be having a go over christmas with the other programs. Thank you.

Cheers
Mark

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Wed Dec 19, 2012 4:55 pm

webbwbs wrote:
alexeames wrote:Well there's been over 100 downloads of the Python Gertboard software so far. I wonder if anybody else apart from the one or two I've heard from has had a chance to try any of the programs yet?
I have now had time to complete the build of my Gert Board and have had a go with your software. I was very please with the results. I've only used the leds program at the moment but I will be having a go over christmas with the other programs. Thank you.

Cheers
Mark
Awesome. You're welcome. :D Let us know how it goes.
Alex Eames RasPi.TV, RasP.iO

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Sat Dec 29, 2012 12:48 pm

A little Christmas bonus for all Gertboarders out there. I've just released a python version of the potmot program. I overlooked it before, because when I put my Gertboard together I didn't have a potentiometer to test it with. :lol:

http://raspi.tv/downloads
or, directly from your Pi...

Code: Select all

wget http://raspi.tv/download/GB_Python.zip
It uses spidev and wiringpi for python. Thanks Myra for suggesting adding this one.
Alex Eames RasPi.TV, RasP.iO

davidb24v
Posts: 19
Joined: Sat Dec 10, 2011 9:32 am

Re: Gertboard Software in Python - Released

Wed Jan 02, 2013 9:37 pm

Alex,

Thanks for all you've done here. I built (aka - lashed together) my Gertboard a while ago, haven't had much time to play with it until now (well, haven't got much time now as we're trying to nurse our beloved cat through an "infection" that turned out to be meningitis). My python skills are not up to the job, yet, but this is so much easier than trying to get the original software to work (no offence intended Gert, after all, C was the world's first "write-only" language :lol:).

I think my motor bits don't work - will check that out more tomorrow. I'd only done up to the led tests before, being able to go further with so little effort has been very valuable. So, onwards and upwards, or, er, whatever :D

Dave

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Thu Jan 03, 2013 12:25 am

davidb24v wrote:Alex,

Thanks for all you've done here. I built (aka - lashed together) my Gertboard a while ago, haven't had much time to play with it until now (well, haven't got much time now as we're trying to nurse our beloved cat through an "infection" that turned out to be meningitis). My python skills are not up to the job, yet, but this is so much easier than trying to get the original software to work (no offence intended Gert, after all, C was the world's first "write-only" language :lol:).

I think my motor bits don't work - will check that out more tomorrow. I'd only done up to the led tests before, being able to go further with so little effort has been very valuable. So, onwards and upwards, or, er, whatever :D

Dave
Thank you Dave, that's very encouraging :D It's always nice to hear back from someone who's found it useful. We're at >800 downloads now, but I expect that to shoot up rapidly when the next board version comes out.
Alex Eames RasPi.TV, RasP.iO

davidb24v
Posts: 19
Joined: Sat Dec 10, 2011 9:32 am

Re: Gertboard Software in Python - Released

Thu Jan 03, 2013 9:01 pm

Been through all the tests now. It works, apart from the motor driver.

I blame the person who clumsily assembled it :lol:

I bought the Gertboard to learn, by the time I got it I sort of already had. Obviously my soldering skills could have been better :oops:

Going to put it on eBay for charity - can't imagine what I'll ever use it for and it would pain me to have it on a shelf gathering dust. SWMBO "does" eBay (me? well I just buy stuff from that China :D ) so I shall request her assistance and we'll get it out there.

Watch this space (well, I'll start a new thread tomorrow when it's out there).

I've learned a lot from playing with this thing, don't want to play any more though - auction will start at 1p, all proceeds to MSRC

Dave

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Thu Jan 24, 2013 5:05 pm

OK. Happy to report that I've just finished testing the Python software on a new Rev 2 production Gertboard.

It all worked as it should. There was one minor hiccup in that the SPI programs (atod dtoa and dad) didn't want to work at first, but after a reboot it was all good. Might have something to do with me being naughty and doing all the wiring without switching off between experiments. Who knows? :lol:

The only thing I might tweak is the motor program on which the "pickup" seems to be a bit slower with the new motor controller chip. Then again, it still works, so might just leave it as is, since everyone's motors will be different from mine anyway. :D
Alex Eames RasPi.TV, RasP.iO

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Fri Jan 25, 2013 10:10 am

Bgreat showed me (thanks Bill) how to use WiringPi for Python to do pullups, so I've implemented wiringpi versions of the butled and buttons programs. I guess that makes the WiringPi set complete. :lol:
Just need hardware PWM for RPi.GPIO and we'll have two full sets.

Usual place http://raspi.tv/downloads or...

Code: Select all

wget http://raspi.tv/GB_Python.zip
directly from Pi
Alex Eames RasPi.TV, RasP.iO

User avatar
leol
Posts: 147
Joined: Fri Jan 13, 2012 4:27 pm
Location: Haute-Vienne, France

Re: Gertboard Software in Python - Released

Fri Jan 25, 2013 2:51 pm

I thing the url is wrong. I think it should be wget http://raspi.tv/download/GB_Python.zip

Leo

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Fri Jan 25, 2013 3:54 pm

Yep it should be...

Code: Select all

wget http://raspi.tv/download/GB_Python.zip
thanks :) (I've tested that one) :lol:
Alex Eames RasPi.TV, RasP.iO

jackisgames
Posts: 6
Joined: Thu Jan 24, 2013 5:41 pm

Re: Gertboard Software in Python - Released

Fri Jan 25, 2013 9:29 pm

hi im running the led-rg.py and the leds lights up but all in the same time

i tried to call only GPIO.output(25,1) but it's seems lights up all the LEDs at the same time
wonder if any good explanation on this one? :|

jackisgames
Posts: 6
Joined: Thu Jan 24, 2013 5:41 pm

Re: Gertboard Software in Python - Released

Fri Jan 25, 2013 10:17 pm

nevermind forgot to put the jumpers in lol
working perfectly now :oops:

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Fri Jan 25, 2013 10:25 pm

jackisgames wrote:nevermind forgot to put the jumpers in lol
working perfectly now :oops:
You're not the first and you won't be the last. :lol:
Alex Eames RasPi.TV, RasP.iO

jackisgames
Posts: 6
Joined: Thu Jan 24, 2013 5:41 pm

Re: Gertboard Software in Python - Released

Fri Jan 25, 2013 11:22 pm

alexeames wrote:
jackisgames wrote:nevermind forgot to put the jumpers in lol
working perfectly now :oops:
You're not the first and you won't be the last. :lol:
i'm a total noobs haha :lol:
also been messing with the connection, if i unplug the GP8 and GP7 and i call the GP10 the B10 led will lights up along with the B8 and B7 leds
also if i call the GP9 will also lights up along with the B9, B8 and B7
but if i call the other is lights up only the corresponded LED

i was wondering why it's happening? hopefully not the jumpers problem again lol :oops:

User avatar
Gert van Loo
Posts: 2485
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Gertboard Software in Python - Released

Sat Jan 26, 2013 12:36 am

There is no pull-up if a BUF port is switched as output.
Thus if you make multiple ports output but do NOT connect them,
they will respond to anything around them. Hence if you drive one pin
high all the pins around it might switch along. (Sometimes, somewhat)
The idea is that if you make a BUF an output you also drive it from the PI.

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Sun Jan 27, 2013 6:36 pm

When I tested my V2 Gertboard this week with the Python programs, I noticed a strange behaviour with the ADC and DAC programs. This has now been identified and the bug squashed. :D

Basically what was happening was if you ran the leds program, it used the spi ports in normal GPIO mode. A quirk of py-spidev, which texy and bgreat happened to pick up on, within a couple of days of me noticing this issue, means that in order for the spi ports to function properly (in the same session) after they have been used as "normal" GPIO ports, the drivers need to be reloaded.

So the code to achieve this has been incorporated into the dad.py, dtoa.py and atod.py programs.

This fixes the fact that all three of these programs would fail to function correctly if you had previously run the leds program in the same session (I'd never previously run all the tests in one session). Once I've fully tested the fix I will push out a new update.

Moral of the story? It pays to look in on threads you're not directly involved with. :D
Alex Eames RasPi.TV, RasP.iO

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Gertboard Software in Python - Released

Sun Jan 27, 2013 7:46 pm

OK, we're there. New spi bug-fixed version uploaded

http://raspi.tv/downloads

and from Pi command line

Code: Select all

wget http://raspi.tv/download/GB_Python.zip
They work OK for me, although during testing I did once see a one line error message
(but the program still worked).
Let me know if these fixes break anything else. (You know how it is :lol: ).
Alex Eames RasPi.TV, RasP.iO

jackisgames
Posts: 6
Joined: Thu Jan 24, 2013 5:41 pm

Re: Gertboard Software in Python - Released

Wed Jan 30, 2013 11:31 am

Cheers for the explanation!! and will play around more with the board on the weekend :mrgreen:

also i was wondering if there's any good tutorial for setting up switches/motors etc on the gertboard for newbie (videos preferably but i'll take on anything)

Return to “HATs and other add-ons”