element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum My success with the Cirrus Logic Audio Card
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 15 replies
  • Subscribers 663 subscribers
  • Views 2356 views
  • Users 0 members are here
  • raspberry_pi
  • raspeberry_pi_accessories
Related

My success with the Cirrus Logic Audio Card

jcjc
jcjc over 9 years ago

Hello,

 

I've had a successful year building and using devices using the CLAC (cirrus logic audio card) since my last visit (http://www.element14.com/community/message/151149/l/re-cirrus-logic-audio-card-working-on-the-raspberry-pi-2#151149).  Returning to this discussion area a year later, I still see lots of good work by individuals, and still some frustration.  I thought I'd quickly recount my experience to those who helped me - I used Ragnar Jensen's .deb's and got help from him that was invaluable.  It is remarkable what is achieved here - on the back of volunteer help - despite people's frustrations and little (no?) input from the manufacturer. 


The device I build is an outdoor audio recorder in a waterproof box with a battery.  In 2014 it was used with a USB microphone, until I found the Cirrus Logic card.  It's been used in 2015 to monitor bird populations by ornithologists.  They have collected several terabytes of audio data used for research.  The performance has been good - the only device that had to be replaced was literally lost-in-the-forest (the deployer forgot where it was located - so it is surrendered to future archaeology).  There have been no hardware failures (20 devices deployed over about 6 months, each recording permanently for as long as the USB battery pack allowed - about 5 days then cycled every week).


The device stores audio in 10-minute long audio files on the SD card, timestamped, and divided into folders one-per-day.  I use the really basic "arecord" to do the recording, sending a signal (USR1 via a cronjob) to it every 10 minutes to split the audio file.  There is no break in the recording at file-boundaries so you can subsequently concatenate the wav files seamlessly (no clicks, no gaps, no overlaps) - this is necessary for the stats which the ornithologists want.  The time-of-day is read at boot-time from the "piface shim" RTC, which works in conjunction with the CLAC without doing anything clever.  I found a good source of microphones for outdoor use recently (micbooster.com in the UK) which use the Primo EM172.Z1 capsule, which I hope to use widely in the coming season (2016).


The "user experience" is to flash a SD card with my customised ".img", plug it into the unit, turn on the power bank, close the waterproof lid and walk away.  Data recovery involves visiting the recorder, collecting (or swapping) the SD card (and battery), and then copying to your PC back in the lab.  This is easy on Mac and Linux, but windows is a nuisance as it won't read my bespoke third FAT partition containing the audio.  (This partition is created and formatted at first-boot and uses up all the remainder of the SD card space thereby fully utilising any size of SD card - I recommend 32 or 64Gb cards).  Users can pre-customize their images by replacing a special /boot/recorder.conf file (which is read/write-able from Windows - nice). Config options include mic-gain, sample-rate (16/32/44.1KHz).  It will have to support stereo/mono for this year (see below).


Plans for the coming year:


(*top priority*) leaarn how to emulate!!!. Developing by ferrying SD cards between my PC and the Raspberry Pi hardware is unmanageably tedious. (looking at pilfs.  XEC design has vanished, I find this whole topic hard to get into). I just want to run a few commands on a stock raspbian to install my code, and upgrade to the CLAC-enabled kernel - to produce a ship-able "img" to users, but I currently boot a bare metal Raspberry pi to do this).

1) try the WittyPi (from UUgear)  power manager so we can have a calendar of when to record.  Hopefully shut down the pi when not in use, and reboot when recording should re-start.

2) move to stereo recording with microphones separated by a meter or so - this will allow direction-of-source analysis to be done back in the lab (x-correlation between L+R).  With a pair of such devices pointing at the same outdoor scene, we can triangulate to find the location of the source of the sound (bird, or whatever).  (Ironically I spent a lot of time fussing with .asoundrc files to get mono working last year)

3) Integrate using larger 12v batteries (SLA or vehicle batteries) to get deployments of a month or more.  This needs a low-loss 12v to 5V (or 3.3v?) regulator.

4) losslessly compress (flac) audio files to increase storage capacity on SD card. (tricky with arecord + kill -USR1) - consider move to gstreamer.

5) move to latest raspbian - integrating 4.? kernel, systemd (does rc.local still work?).

6) Power : does the raspberry pi zero give any saving on power usage (crikey! - no header pins, what a hassle).

7) ultrasound for bats.

 

I'm sticking with the arm-V6 raspberry pi's (version A+) as the pi-2 (V7) is too power hungry.  I'll shortly have to catch up with all the posts on this site regarding what has changed since a year ago.  HiassofT's stuff looks interesting and good old Ragnar is hopefully still around.  Systemd, jessie, kernel-4.1, device-tree are on my mind.

 

Note that I don't sell these.  I've built a few for friends, but most are assembled by users (they are pretty easy to assemble with my guidance on the phone and email). I'll upload a public copy of the .img if there is any interest - but it is a year old (based on raspbian from February 2015, I think...)

 

So life is good, and these devices work well.  A huge thanks to those who have made this happen.  There are real consequences of this work (for a few PhD students, and some British birds at least).

 

Happy new year to you all.

 

James.

 

Images for fun: 

First is the bare recorder.

Second is the B+ with piface shim RTC ready for CLAC installation.

Third is the unit in waterproof box, ready to deploy (this is an older version using USB microphone - so no cirrus card on this one).

Fourth is another of the old-fashioned USB mics  - this time the anatomy.  Note: I've given up on the power-off switch - nobody used it.


 

imageimage

imageimage

  • Sign in to reply
  • Cancel
  • jcjc
    jcjc over 9 years ago in reply to Former Member

    Dear Paul,

     

    I did this:  https://github.com/solosystem/solo/blob/master/setup-rtc.sh

     

    I don't think it's special, except in 2 ways that are not relevant here.  Firstly, I get the RTC enabled as early as possible in the boot process (the above is called from /etc/init.d/hwclock.sh (I dump fake-hwclock.sh because it leads to misleading timestamps).  Secondly, it is _so_ early in the boot sequence that "/" is not mounted yet, so I need to wrap it in a utility (new to me) called "logsave".

     

    I mention the above so you don't go chasing things that are irrelevant.  The commands within the above script could equally well be run at the command line once the system is fully booted and you have logged in.  One thing I did notice is that one _does_ get errors (warnings, really) when one tries to read the time from an UNSET (new or new battery) RTC clock.  But your problem sounds more serious than that.

     

    You did put a battery into your piface shim, right ?  And it's not a dead battery?  Sorry to state the obvious.

     

    James.

    PS - to interrogate and set the clock I have the rather ugly: https://github.com/solosystem/solo/blob/master/test-rtc.sh but again, nothing special there.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 9 years ago in reply to jcjc

    James,

    Thanks for your help which eventually led me to the source of the problem.  Some time ago I tried a DS1307 RTC unsuccessfully and the driver was still being loaded, plus I found an error in my rc.local which was preventing it from running.  So, after a whole evening I now have the RTC running with my CLAC and USB touchscreen on my Pi2.

    Just waiting on some fine weather for some bats!

     

    Many thanks,

     

    Paul

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 9 years ago

    Hi James,
    Excellent work! As a PhD student studying soundscape ecology you're indeed correct that this work could have real consequences as currently off the shelf solutions (e.g. Wildlife Acoustics SM3 and SM4) are too expensive for many project operating on a budget. I have therefore been looking into putting together an autonomous field audio recorder on a budget over the last few weeks myself and have also decided on using the Primo EM172.Z1 capsule (which looks like the same/similar spec as Wildlife Acoustics use in their SM3 recorder) and the EC Tech USB battery shown in your pic (it seems to be one of the few batteries of this type which doesn't vastly over exaggerate its capacity) but am struggling to find a digital recorder that combines the ability to record in mono, runs off USB battery and can take a 64 GB SD card. So far the Tascam DR-70D has looked most promising but it's £200 and still only gives about 5 days battery life with the EC Tech. I've also been looking into using mobile phones as an alternative but am concerned their pre-amps aren't up to the job and have read something about a 2 GB file size limit.

     

    I was therefore very interested to find your blog and was wondering if you could tell me what kind of battery life you get with your EC tech (assuming it's a 22,400 mAh model?) and what kind of data life would you get on for a 64 GB SD card, assuming it will take up to 64?

    Many Thanks,
    Rich   

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • jcjc
    jcjc over 9 years ago in reply to Former Member

    Hi Rich, (sorry for late response)

     

    I get 5 days from the EC tech 22.4mAh battery  - recording 16kHz, mono audio 24 hours a day.  However, that was last year - this season, the deployments are using (40 UK pounds each) car batteries.  I expect to get about 4 weeks from them.  One came back from the field yesterday and had conked out after 42 days (6 weeks) - but I think that's freakishly long, and don't expect it to be representative

     

    The system will accept any capacity of micro-SD memory card - this year I am using 128Gb cards which can hold about 6 weeks of audio at 16kHz - which matches well with the car battery.

     

    The system happily accepts any size of SD-card (raspberry pi supports both SDHC and SDXC, so in principle up to 2TB, but I don't see anything bigger than 256GB on sale).  I deployed 128GB cards in the 40 units I built this year, and that accommodates 6 weeks of data at 16kHz, 16 bit, mono uncompressed (thereabouts).

     

    So far the quality of the Primo microphones seems great, but that's just subjective - I haven't compared with SM2/3/4 yet, because I'm not sure how to do it meaningfully (in my house - unfortunately

     

    I agree with your opinion of the EC Tech battery - I did a few capacity experiments some time ago, and it does actually seem to have the stated capacity.

     

    Let me know if I you remain interested.

     

    James.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • jcjc
    jcjc over 9 years ago

    Hello all,

     

    The Solo outdoor recorder project (based on the Cirrus Logic Audio Card) now has a website at  https://solo-system.github.io/

    Including a video of the assembly process (blush).

     

    I now have it additionally working with the Pi Zero (albeit at 80mA rather than 70mA for the A+ boards).  And we are using car batteries this year, and getting deployment times of around 40 days of permanent recording (arecord running non-stop for 40 days) - a good data-point to have in the "Is it stable?"  debate.

     

    A few new people have picked it up recently and broadly found it useful.

     

    James.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
<
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube