timrowledge
Posts: 1264
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Scratch & camera module

Wed Jan 15, 2014 1:40 am

You can use a pi camera module with Scratch now that v4l2 is supported properly.
It should 'just work' if you have the v4l update installed & working ok. You can test that with

Code: Select all

mod probe bcm2835-v4l2
and if it returns nothing then all should be well.
I must admit that the colour mapping seems a bit naff. To call it Smurfy would be an understatement, so clearly some tweaking is required. Nonetheless, it's nice to have working at all!

Oh, this is with 'old scratch'. ScaryNuScratch does not support this yet.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

mrteach
Posts: 181
Joined: Sun May 26, 2013 6:49 am

Re: Scratch & camera module

Thu Jan 16, 2014 5:30 am

do you have an example program you can upload to youtube with a demo of it's use in scratch?

ghp
Posts: 1352
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Scratch & camera module

Thu Jan 16, 2014 5:34 pm

Hello,

in scratch, go to a sprites 'costume' tab, and in 'new costume', press 'camera'.
Can't be used in scripts, just for the creation of new costumes.

Greetings
Gerhard

timrowledge
Posts: 1264
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Scratch & camera module

Fri Jan 17, 2014 1:16 am

ghp wrote: Can't be used in scripts, just for the creation of new costumes.
Hmm, maybe we should do something about that.

It looks like some minor configuration of the use of the camera library is needed in order to correct the colour mapping. A picture of my red dalek came out blue, which simply isn't acceptable.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

ghp
Posts: 1352
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Scratch & camera module

Fri Jan 17, 2014 9:56 am

ghp wrote:Can't be used in scripts, just for the creation of new costumes.


Hmm, maybe we should do something about that.
Hmm, hmm. I do not see the need for embedding this in scripts. In 1.4, this is a mechanism to build sprites, similiar to audio records. Scripted recordings of any type also impose scripted processing, storing, naming... Scratch is not the place for this.

Another point is, that I advertise windows scratch 1.4 for the school kids as a tool to continue workshop work at home. If there are differences, there is confusion too.

Greetings
Gerhard

bantammenace2012
Posts: 122
Joined: Mon May 28, 2012 12:18 pm

Re: Scratch & camera module

Thu Sep 25, 2014 9:20 pm

To date I've been using the Python Picamera to control my RPi camera module.
Though comprehensive its a bit too much for a young noob.
I was just wondering if its possible/likely/feasible to have any control over the camera settings using Scratch ?
Perhaps something like raspistilll or raspivid to get started rather than the on-the-fly Picamera stuff.

timrowledge
Posts: 1264
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Scratch & camera module

Tue Sep 30, 2014 6:19 pm

bantammenace2012 wrote:I was just wondering if its possible/likely/feasible to have any control over the camera settings using Scratch ?
Should be possible. I'll add it to the list of stuff I hope to do; in the meantime, see if you can convince the foundation education team it's something they'd like too. Then there'd be a good case for it getting done.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

achurch0607
Posts: 3
Joined: Thu May 08, 2014 12:07 am

Re: Scratch & camera module

Sat May 09, 2015 11:14 pm

This post has been quiet for a while but I thought I would post this incase anybody else had the same question. This link helped get me started with Scratch and the camera module for my kids. http://www.mattvenn.net/2014/12/16/usin ... pberry-pi/

JamesJefferson
Posts: 1
Joined: Tue Jan 05, 2016 9:29 pm

Re: Scratch & camera module

Tue Jan 05, 2016 9:34 pm

Please help.
My camera works from the command line 'raspistill' command but in scratch the camera feature to capture an image for a Sprite or background isn't working. I can't find any help to determine what's wrong.

All help much appreciated!
Thanks!
JJ.

timrowledge
Posts: 1264
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Scratch & camera module

Wed Jan 06, 2016 8:44 pm

JamesJefferson wrote:My camera works from the command line 'raspistill' command but in scratch the camera feature to capture an image for a Sprite or background isn't working.
It's been a long while since anyone reported a problem with the camera; I thought we had solved all that!

If you (in a terminal) enter -

Code: Select all

vcgencmd get_camera
you should see

Code: Select all

supported=1 detected=1
if you have a camera installed.
Assuming that - which really ought to be the case if it's working from `raspistill` - then the scratch startup script should be installing the bcm2835-v4l2 kernel module. So let's check if it is installed -

Code: Select all

lsmod | grep bcm2835_v4l2
{ note the use of underscore '_' here instead of minus '-'; I have no idea why that is required to be so}
You should 'bcm2835_v4l2' as the first of several lines of output. If you don't, we have a problem.

If you do see 'bcm2835_v4l2', then start Scratch afresh and try using the camera. If it now works, then at least the core stuff is ok and we need to find out why it doesn't work by default.
In a Terminal try

Code: Select all

grep 2835 /usr/bin/scratch
that should return 'sudo mod probe bcm2835-v4l2'. If it *doesn't* then you probably have a far too old version of Scratch on your Pi, so update everything in the usual manner. In fact, since that change goes back quite a way, I'd suggest doing a fresh install of the latest Raspbian.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

Gary.
Posts: 7
Joined: Tue Mar 03, 2015 10:15 pm

Re: Scratch & camera module

Fri Feb 05, 2016 10:20 pm

Actually re-reading your response, are you suggesting that I can't take full resolution with the HD camera?

Return to “Scratch”