Jump to content
  • Join the online East Midlands astronomy club today!

    With active forums, two dark sites and a knowledgeable membership, East Midlands Stargazers has something for everyone.

Raspberry Pi with ASI120MC camera


TasKiNG
 Share

Recommended Posts

Rather than discussing this on the "Latest Purchases" thread I have created this one to record my progress in making a hand held AVI capture device for my ASI120MC.

 

The Raspberry Pi I am using is a Model B and I have fitted a 2.8" TFT LCD display.

 

cam_lcd.jpg

 

I am connecting the ASI120MC to the USB port on the Raspberry Pi Model B board.
The Drivers and capture software is oacapture from the Open Astro Project here:  http://www.openastroproject.org/downloads/ Download the ARM (Raspian) version then just unzip/untar and run the install script as per the README file.

The TFT display I am using is here: http://www.ebay.co.uk/itm/2-8-TFT-Touch-Shield-Display-Board-for-Raspberry-Pi-fully-assembled-/221397828999

The Weezy image I am using that directly supports the display is here: http://tronnes.org/downloads/2014-01-07-wheezy-raspbian-2014-03-12-fbtft-hy28b.zip

 

stash, on 23 Mar 2014 - 16:32, said:
Hi Dave,

Have you tried this driver on the ZWO site (might be the same one !) http://zwoug.org/viewtopic.php?f=21&t=400&start=10

 

 

Thanks Clive, I had a look at that and they are using the same ZWO ASI SDK as oacapture but I might have to look into INDI to get PHD working on the pi with this camera.

 

I have had a bit of a breakthrough with getting the fps increased. If I select RAW in oacapture then get around 8 fps at full resolution and 24 fps with a ROI of 640x480.   The resultant AVI file can then be De-bayered back to colour using the debayer option in Autostakkert.

Edited by TasKiNG
Link to comment
Share on other sites

  • Replies 57
  • Created
  • Last Reply

Top Posters In This Topic

  • xanthic

    8

  • stash

    27

  • TasKiNG

    21

Thanks Leigh I hadn't seen that. The Indi driver for ZWO is quite new - 2nd release Feb 2014 I think so I expect there will be problems especially as it not being done directly by ZWO or so it seems - ZWO do promise a Linux version (When!) 


 


Dave,


 


Glad to hear you have had an "bit of a breakthrough".


 


I must admit as was not going to use the PI for "guiding" and it was not my intention to  use any form of graphics interface on the PI - just good old command line or text based interaction via Python and SSH. Then stream the data (Focusing should be interesting). AND I am using the PI camera not ZWO - YET !


 


As I understand it , and as one would expect, the ZWO makes heavy use of  memory buffering and is USB bandwidth hungry but should have a higher rate than what you have experienced even if you get a lot of "dropped frames". 


 


Although its not what you want for your project have you tried to run the set up without the TFT Screen to see what rate you get then - doubt it will make a difference but you never know.


 


Still all good fun - good luck.


Link to comment
Share on other sites

A couple of things spring to mind. Make sure you are using the fastest possible storage for the device. SD cards are not as fast as a HDD, if you can get an SSD even better.


 


The screen is running off the GPIO so shouldn't cause to much load, no more than say running X or VNC over the network.


 


It might be worth checking the memory/GPU memory balance and seeing what you can get away with.


Link to comment
Share on other sites

A couple of things spring to mind. Make sure you are using the fastest possible storage for the device. SD cards are not as fast as a HDD, if you can get an SSD even better.

 

The screen is running off the GPIO so shouldn't cause to much load, no more than say running X or VNC over the network.

 

It might be worth checking the memory/GPU memory balance and seeing what you can get away with.

Thanks Leigh - Makes sense but always worth "seeing is believing".

Link to comment
Share on other sites

Thanks Leigh I hadn't seen that. The Indi driver for ZWO is quite new - 2nd release Feb 2014 I think so I expect there will be problems especially as it not being done directly by ZWO or so it seems - ZWO do promise a Linux version (When!) 

 

Dave,

 

Glad to hear you have had an "bit of a breakthrough".

 

I must admit as was not going to use the PI for "guiding" and it was not my intention to  use any form of graphics interface on the PI - just good old command line or text based interaction via Python and SSH. Then stream the data (Focusing should be interesting). AND I am using the PI camera not ZWO - YET !

 

As I understand it , and as one would expect, the ZWO makes heavy use of  memory buffering and is USB bandwidth hungry but should have a higher rate than what you have experienced even if you get a lot of "dropped frames". 

 

Although its not what you want for your project have you tried to run the set up without the TFT Screen to see what rate you get then - doubt it will make a difference but you never know.

 

Still all good fun - good luck.

 

Thanks Clive, I tried it without the TFT LCD attached and the fps was no better.

Last night I managed to install INDI so going to have a play with that later.

 

That expansion board looks neat.

 

: A couple of things spring to mind. Make sure you are using the fastest possible storage for the device. SD cards are not as fast as a HDD, if you can get an SSD even better.

The screen is running off the GPIO so shouldn't cause to much load, no more than say running X or VNC over the network.

It might be worth checking the memory/GPU memory balance and seeing what you can get away with.

 

 

 

Thanks Leigh, I using a SDHC Class 10 card with a write speed of 17MB/S. I agree a SSD would be better but i'm trying to keep the size ( and cost ) down.

I did a rough calc and at this resolution it should cope with approx 14fps at full resolution so I think the bottleneck is elsewhere.

The CPU sits at 100% when capturing so the limitation is likely to be the CPU speed.

Will be interesting to try over clocking it next.

 

I'll look into how to balance the memory / gpu later too.

Link to comment
Share on other sites

Hi Dave,


 


Worth a try


 


a few boring pics of the semi ass PI ,Exp Board and camera


 


https://drive.google.com/file/d/0B9aHac2P5RgVT3FVU2NBWF9ma1k/edit?usp=sharing


https://drive.google.com/file/d/0B9aHac2P5RgVMnp3VnVrWU9IOTQ/edit?usp=sharing


https://drive.google.com/file/d/0B9aHac2P5RgVWktoZ1FoRkVNb0U/edit?usp=sharing


https://drive.google.com/file/d/0B9aHac2P5RgVNlhkaHVBenZRTzA/edit?usp=sharing


https://drive.google.com/file/d/0B9aHac2P5RgVa3Nxa0NZVnh2MzA/edit?usp=sharing


 


 


Couldn't resist it I have bought one of the TFT screens - need another PI now  :D


 


Will be trying the fully ass kit tonight after some tests if everything goes well - without the camera all works as expected - drives old VGA TFT screens no problem. Not tested the battery connection as exp board should work with 12v battery


 


If that all works then some Telescope trials - can't imagine the pics will be much but who knows  :)


Link to comment
Share on other sites

 

Couldn't resist it I have bought one of the TFT screens - need another PI now  :D

 

Your expansion board looks great.

Found a better spec SD card so going to try that later too :)

The little TFT screens are great. Obviously at this resolution you don't see the whole application on the screen but I have found that you can easily move the application around by pressing ALT whilst dragging with the mouse. I'll post a youtube vid of it capturing avi when I've got it sorted.

Link to comment
Share on other sites

Camera working and connected from windows laptop to PI as we speak (this is coming that route) Camera seems quite fasp for both stills and vid. Bummer you can't seem to see the vdeo output over tightvnc - will look further and investigate streaming to see if that gives me what i want.  We do the same with the capture vid files i have produced so far about 5mb


Link to comment
Share on other sites

Ok did some testing with NCAT and Mplayer on windows picking up pi camera output and displaying in another Windows 7 window. Works and video looks ok just about 30 - 60 secs lag behind the actual camera.


 


This is over a wireless network and I was having to run a VNC viewer to the PI because I couldn't find the "pipe" key on my mini keyboard connected to PI  :facepalm:  no matter what keyboard i configured. :dontknow:


 


Anyway some progress but still a little way off putting it on a scope. Windows Firewall got in the way to start with but putting Ncat in as a exception worked - If you have a Anti Virus program that has a Firewall you will have to do the same. I am just using std Windows 7 f/wall.


 


boring pics


 


https://drive.google.com/file/d/0B9aHac2P5RgVVXZxWElCUlR4akk/edit?usp=sharing


https://drive.google.com/file/d/0B9aHac2P5RgVaHRVN2x3eUY5bVE/edit?usp=sharing


Edited by stash
Link to comment
Share on other sites

Sounds like you are having fun Clive. Does streaming to windows use much CPU capacity?


 


I'm still trying to get the fps higher but not getting anywhere. here's the results of my testing:-


 


Overclocking:  With Max speed it crashed. All other speeds was stable but no significant fps increase


Mem/GPU split:  Tried all of the combinations with no improvement.


Better spec SD card:  No improvement


Storing to USB hard drive: No  improvement


 


So I think the best i'm going to get is 6fps at full resolution and 24fps at 640x480 so long as I record in RAW ( unbayered) mode.


 


This was all with oacapture.


 


What is a good Raspbian video capture program that I can try with the INDI driver?


Link to comment
Share on other sites

Hi Dave,


 


Have you tried creating a ram disc to store the output 


 


link to how to http://www.thegeekstuff.com/2008/11/overview-of-ramfs-and-tmpfs-on-linux if you need help with setup of ram.


 


Don't have any experience of using the Indy driver - I would send an email to the guy,chripell@gmail.com, who seems to be working with Sam from ZWO and ask him as he must be testing it with something.


 


If I see anything i will send you the info.


 


P.S. Indy appears to be used with guiding using Openphd and appears as some sort of Remote Access Server that passes the info from the driver to a client which maybe on different machines so this may not be what you are looking for. :(


Edited by stash
Link to comment
Share on other sites

Have you looked at VLC?

 

I use VLC quite a bit on my Mac & PC's for Audio / video & streaming. It's a great program

 

Hi Dave,

 

Have you tried creating a ram disc to store the output 

 

link to how to http://www.thegeekstuff.com/2008/11/overview-of-ramfs-and-tmpfs-on-linux if you need help with setup of ram.

 

Don't have any experience of using the Indy driver - I would send an email to the guy,chripell@gmail.com, who seems to be working with Sam from ZWO and ask him as he must be testing it with something.

 

If I see anything i will send you the info.

 

P.S. Indy appears to be used with guiding using Openphd and appears as some sort of Remote Access Server that passes the info from the driver to a client which maybe on different machines so this may not be what you are looking for. :(

 

The Pi only has 512 MBytes of physical ram so not enough for video capture to a ram drive.

I think you are correct about the INDI driver being used for PHD. That's next once I sort the video out :)

Edited by TasKiNG
Link to comment
Share on other sites

"The Pi only has 512 MBytes of physical ram so not enough for video capture to a ram drive. " - I was thinking more in the line of a temp ram so that you could capture in blocks of say 50mb and have a automated looping script which moves the file from RAM to somewhere as the next "block" of video is being written.  Does depend on the capture s/w allowing this - does OAcapture have this as an option ?

 

Really only a suggestion to narrow down the problem as you seemed to have tried Std problem solving methods already - memory/processor etc

 

It maybe we will have to wait for the ZWO official Linux driver or off load the video stream to a PC which I guess that's not your aim (wasn't mine either)

 

Its seems to be a case of "going where no man has gone before" 

 

Have you tried changing the Priority of the OAcapture program - it would need to be run as "root" (sudo) ?

 

Using Terminal:

 

sudo top

this will show you the processes with pid

 

renice {priority} pid
this will change the priority (niceness) of the process. The nicer the process is, the lower priority it will have. It's nicer because leave its time-slot to other processes

 

{priority} is from -20 to 19

 

As you have probably guessed I am running out of ideas - will try and engage brain better  :chin_scratch2:

Link to comment
Share on other sites

Dave ,

 

I found this on a site which if true is this reason why you are not getting the full FPS.

 

"The reason that the video is so fast when using the Raspi camera is that the mighty GPU does all the heavy-work of doing the h264 encoding.
But when using an external (USB I presume) webcam, it’s the weedy CPU that has to do the heavy h264 encoding, and as you’ve seen you only get very low framerates.

I did a quick search, and http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=22019 suggests that USB webcams are unable to provide data in a format suitable for the GPU encoder? I’m afraid video stuff is all a bit above my head."

 

site - http://raspi.tv/2013/how-to-stream-video-from-your-raspicam-to-your-nexus-7-tablet-using-vlc

 

Which would seem to suggest that the ASI120MC driver via OACapture may not be using the PI's on board GPU - how you would find that out i don't know. Suppose the guy who created the driver may know. Hope its wrong  :(

Link to comment
Share on other sites

Streamed H264 video 640x380 FPS 25 across wireless connection to Windows 7 PC -  3.4mb file created at the same time as video playing on PC


 


Above the above res / FPS streaming starts to break up - but the pic on the Rasp Pi is fine at FPS 30+ 1900x1000(ish)


 


Link to example https://drive.google.com/file/d/0B9aHac2P5RgVemRTZ0dPUmNwLTg/edit?usp=sharing

Link to comment
Share on other sites

Thanks for the info and links. Your video looks very good quality. Just needs some comedy music for when your hand walks across the screen  :D


 


Shame about the GPU not supporting external USB cameras. Wonder if this is a hardware limitation or if it is something that will be improved by a future firmware release.


 


I'm getting reasonable frame rates if I record raw ( unbayered ) video but this limits me to using Autostakkert which is the only program that can read the raw video.


FireCapture comes with a Debayer program but complains that the AVI is not Y800 format.


 


I'll have to brush up on my programming skills as I want a cut down oacapture that has big buttons for my touch screen and fits nicely into the 320x240 display resolution.


Link to comment
Share on other sites

Have you tried using PIPP to reformat the video?

.

 

I tried PIPP but couldn't get it to work.

 

I've linked to a small ( 20MB ) Raw AVI  >>here<<  if you fancy having a play :)

Edited by TasKiNG
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.