hex705

the first creature to discover water was likely not a fish

Uncategorized

Web cam on a YUN

leave a comment

I have a YUN and I want to take a picture with it.  I have a book called: Internet of Things with the Arduino Yun by Marco Schwartz.  Like a lot of these book it take a few leaps of faith — but overall I am happy.

 

I wanted to test the web cam feature —  cause someone told me that “the world is like all about image man”.  And i plan to prove them wrong.

I needed a webcam (and it had to be UVC compatible).  Went to a big box ignored the stares from the staff when asked them about UVC driver compatibility.  They suggested I needed a new computer cause they never heard of a Yun (nor arduino) — I let that one slide.  Fortunately know some model numbers from here and bought a cheap one.

Purchased logitech c270

Using my newly formatted sd card — I was away to the races.

You need to ssh into the Yun linux processor to install necessary software onto the Yun.  From the terminal in your laptop —

ssh root@ IP_OF_YOUR_YUN
password: YOUR_PASSWORD

You should now be at command line prompt in your Yun.   You will be logged in as root so will have a ‘~’ prompt.

You can <code>cd / and ls -al </code> to see the usual linux file structure.

As per above book installed several packages:

opkg update
opkg install kmod-video-uvc
opkg install fswebcam

Packages installed, sd card inserted, camera plugged to Yun usb (check ,check, check) — take a picture.

at command line type

fswebcam test.png

Fail. Got this:

--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Adjusting resolution from 384x288 to 352x288.
--- Capturing frame...
VIDIOC_DQBUF: No such device
No frames captured.

At this point I look for the trouble shooting section of the book. Nothing. I like this book, I do, really, but a couple of crumbs regarding what can go wrong wouldn’t hurt.

Some google advice from the raspberry pi community suggests that this is not uncommon. But they suggest is has to do with power — which may be, but I am attached to a wall outlet so I really hope not.

At command line try the picture with a little more feedback ( add a -v :: for verbose):


fswebcam test.png -v

now I get error above plus:

src_v4l2_set_pix_format,554: 0: [0x56595559] 'YUYV' (YUV 4:2:2 (YUYV))
src_v4l2_set_pix_format,554: 1: [0x47504A4D] 'MJPG' (MJPEG)

 

the camera seems to only produce these formats. Man page time — the pallet switch helped me out:


fswebcam --help

    -p, --palette 
              Try  to use the specified image format when capturing the image.

              Default is to select one automatically.

              Supported formats:

              PNG
              JPEG
              MJPEG
              RGB32
              RGB24
              BGR32
              BGR24
              YUYV
              UYVY
              YUV420P
              BAYER
              RGB565
              RGB555
              GREY

I try
fswebcam -p YUYV test.png -v

And I get a picture. Cool.

Some messing around suggests I only need the -p YUYV switch the first time after re-boot. I can leave out after that — YMMV.

So now the second ( and subsequent) pictures can be captured like this:


fswebcam test.png

Note:: that the image is stored in what ever directory your using when you type above command. So I suggest you nav over to your sd card before taking any more pics (and maybe delete those first few unless they are keepers). Assuming your card is in the default location.


cd /mnt/sda1

now type to snap a shot. it will be on your card!

Excellent. The book suggests you unmount the card and put in your laptop and look at your pic — and this works to be sure — (NOTE that unmount command skips the first ‘n’ — umount — so you will get a command not found error if you type it human style).

nav away from the card — you will get a resource busy otherwise.

cd ~
umount /dev/sda1


sd card is unmounted -- safe to pull it out.

stick card in laptop nifty you have a camera (sort of).

But this whole mount / unmount — move card thing gets old the second time. But fortunately really smart people exist and they knew about setting up the /arduino/www directory.  Check it out.

Follow the instructions at above and now you can command line click in your Yun and web browser view your pics from your laptop — no card swap needed.

That’s cool.

 

A couple of other things I learned along the way ….

dmesg
To see kernel messages — these should include a block about your camera and a block about your sd card.

you can also try:

lsusb

To see the USB devices connected (including your camera and card reader).

lsmod
To list modules including the libraries installed above.

 

RESOURCES:

this forum post also came in handy 

Written by hex705

June 30th, 2014 at 12:04 am

Posted in Uncategorized

xCode Blues

leave a comment

xCode crashes ” internal error” at start up.  What now?

These are some fast scratched notes on how I am trying to solve this.

fix disk permissions – no luck

cleaned caches – no fix

cleaned prefs – no fix

used Lion cache cleaner — no luck

 

clean install of dev tools (i deleted dev tools manually and tried reinstall — but that didn;t fix it — makes sense — so my bad).

1) REMOVE.  in Terminal:

/Library/Developer/4.2.1/uninstall-devtools --mode=all

you need to be admin and may need to prefix with sudo:

sudo /Library/Developer/4.2.1/uninstall-devtools --mode=all

check your version.

(see: http://stackoverflow.com/questions/7873991/how-to-remove-xcode-4-2-and-install-4-1-to-develop-ruby-rails-on-osx-lion)

2) app store and get it again — app store download an installer — not the app.  SO, if app store says you have xCode — find the install xCode file lurking on your drive (likely in downloads) — delete it.  App store will tell you you don;t have it anymore and get you a new installer.

all else fails — as of Nov. 17, 2011 4.1 avaialble here:

 

https://daw.apple.com/cgi-bin/WebObjects/DSAuthWeb.woa/747/wo/w0bCT1D8XzaH2gYfb6Gjg0/3.3.3.1.1.2.1.1.3.1.1

need dev ID, its not linked publically, but seems to work.

 

 

 

Written by hex705

November 18th, 2011 at 9:17 am

Posted in Uncategorized

Arduino to Processing — Multiple Data Points

leave a comment

Sending a single data point from the physical world into media systems is reasonably straight forward. Sending multiple data points can be much more complex.   This post outlines a simple strategy for sending multiple data points from Arduino to Processing. 
Read the rest of this entry »

Written by hex705

October 20th, 2010 at 10:14 pm

Posted in Uncategorized