Planet Linux Australia

Syndicate content
Planet Linux Australia - http://planet.linux.org.au
Updated: 1 hour 18 min ago

Michael Fox: Realtek RTL2838 DVB-T tuner on Raspberry Pi with TvHeadEnd success

Fri, 2014-06-27 20:26

I decided to give my DVB-T usb dongle (Realtek RTL2838) another go with the Raspberry Pi and TvHeadEnd. As I thought the newer version of Raspbian if available might address the condition I had previously where I had no dvb device after plugging it in. Older post found here.

It would appear it was a good to check this out again.

I downloaded the latest Raspbian available from the Raspberry Pi site. The version available at the time of this post is the one below;

2013-12-20-wheezy-raspbian.zip

I installed to an SD card and booted my Raspberry Pi.

I plugged in my Realtek RTL2838 tuner and it detected fine and when I checked for the dvb device structure, it was populated all correctly, which never happened previously at all.

[26848.628778] usb 1-1.3: new high-speed USB device number 6 using dwc_otg [26848.741110] usb 1-1.3: New USB device found, idVendor=0bda, idProduct=2838 [26848.741147] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [26848.741166] usb 1-1.3: Product: RTL2838UHIDIR [26848.741183] usb 1-1.3: Manufacturer: Realtek [26848.741199] usb 1-1.3: SerialNumber: 00000001 [26848.851456] usb 1-1.3: dvb_usb_v2: found a 'Realtek RTL2832U reference design' in warm state [26848.857238] usbcore: registered new interface driver dvb_usb_rtl28xxu [26848.921368] usb 1-1.3: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer [26848.921447] DVB: registering new adapter (Realtek RTL2832U reference design) [26848.965698] usb 1-1.3: DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))... [26849.001551] r820t 0-001a: creating new instance [26849.014447] r820t 0-001a: Rafael Micro r820t successfully identified [26849.021655] Registered IR keymap rc-empty [26849.022183] input: Realtek RTL2832U reference design as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/rc/rc0/input0 [26849.022231] rc0: Realtek RTL2832U reference design as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/rc/rc0 [26849.022262] usb 1-1.3: dvb_usb_v2: schedule remote query interval to 400 msecs [26849.035148] usb 1-1.3: dvb_usb_v2: 'Realtek RTL2832U reference design' successfully initialized and connected

And device files

root@raspberrypi:~# ls -la /dev/dvb total 0 drwxr-xr-x 3 root root 60 Jan 1 14:51 . drwxr-xr-x 13 root root 3080 Jan 1 14:51 .. drwxr-xr-x 2 root root 120 Jan 1 14:51 adapter0 root@raspberrypi:~# ls -la /dev/dvb/adapter0/ total 0 drwxr-xr-x 2 root root 120 Jan 1 14:51 . drwxr-xr-x 3 root root 60 Jan 1 14:51 .. crw-rw---T 1 root video 212, 4 Jan 1 14:51 demux0 crw-rw---T 1 root video 212, 5 Jan 1 14:51 dvr0 crw-rw---T 1 root video 212, 3 Jan 1 14:51 frontend0 crw-rw---T 1 root video 212, 7 Jan 1 14:51 net0

Next I configured other tools before compiling and installing the TvHeadEnd per the steps below;

sudo apt-get install unzip libcurl4-openssl-dev pkg-config git build-essential dvb-apps

cd ~

git clone https://github.com/tvheadend/tvheadend

cd tvheadend

./configure

make

sudo make install

At which point I executed the binary via “tvheadend -C” and I could now access the web interface for the TvHeadEnd software via http://raspberrypi_ip:9981/ where I could now see my dvb tuner was detected.

At this point you now have to configure the network and channels according to your region. Can be a bit tricky, but I followed the info available at the post here (step 14). This helped me make sense of the sequence of actions.

Below is a screen grab showing VideoLan Client from my Windows 7 desktop and a web browser in the background attached to the TvHeadEnd which is running on the Raspberry Pi with the RTL2838 tuner.

EDIT: And to get my TvHeadEnd to auto start with boot I performed the following additional steps.

Created /etc/init.d/tvheadend file with the contents below;

#!/bin/bash ### BEGIN INIT INFO # Provides: tvheadend # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Should-Start: $syslog # Should-Stop: $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 # Short-Description: start/stop tvheadend Server ### END INIT INFO TVHNAME="tvheadend" TVHBIN="/usr/local/bin/tvheadend" TVHUSER="tvheadend" TVHGROUP="tvheadend" PIDFILE=/var/run/$TVHNAME.pid start() { if [ -e $PIDFILE ]; then PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}') if [ -n "$PID" ]; then echo "$TVHNAME already running (pid $PID)." exit 1 fi fi echo -n "Starting tvheadend: " start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user ${TVHUSER} --exec ${TVHBIN} -- -u ${TVHUSER} -g ${TVHGROUP} -f -C echo "Done." } stop() { if [ -e $PIDFILE ]; then PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}') if [ -n "$PID" ]; then echo -n "Stopping $TVHNAME: " start-stop-daemon --stop --quiet --pidfile $PIDFILE --name ${TVHNAME} echo "Done." else echo "$TVHNAME is not running." fi else echo "$TVHNAME is not running." fi } status() { if [ -e $PIDFILE ]; then PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}') if [ -n "$PID" ]; then echo "$TVHNAME is running (pid $PID)." else echo "$TVHNAME is not running." [ -e $PIDFILE ] && exit 1 || exit 3 fi fi } case "$1" in start) start ;; stop) stop ;; restart) stop && sleep 2 && start ;; *) echo "Usage: $0 [start|stop|restart|status]" && exit 1 ;; esac exit 0

Now set the script as executable using below;

sudo chmod 755 /etc/init.d/tvheadend

Create a tvheadend group

sudo groupadd tvheadend

Create a tvheadend user that is part of the video group and tvheadend group.

sudo useradd -g tvheadend -G video -m tvheadend

And now set the initscript tvheadend to startup and shutdown as system does

sudo update-rc.d tvheadend defaults

Andrew Pollock: [life] Day 149: Kinderdance open day, and not much else

Fri, 2014-06-27 19:25

Today was the much anticipated open day for the last Kinderdance class of the term, where I actually get to see what we got for our money.

I'd offered to pick up Sarah and her mother from the city and transport them there and back, since neither of them drive to work, so we got ready early and drove into the city to collect them and then drove over to the Kinderdance venue.

Mum and Dad arrived shortly afterwards, and we all sat at one end of the dance floor to watch the girls perform.

It was really cute. It was, as best I can tell from when I've peeked through the window from the adjacent kitchen, just like any other lesson. The teacher still led the whole thing, but I guess the girls all had it pretty much ingrained in them after 10 weeks.

The theme was "under the sea" so all of the warm ups and actual "dance" routines were all vaguely nautical. It was really great to watch, and Zoe looked like she enjoyed herself. She kept waving and blowing kisses to all of us in the audience.

Mum and Dad came back to my place for lunch afterwards. Zoe and I dropped Sarah and her Mum back in the city first.

After lunch and a bit of a play with grandpa, Mum and Dad left, and then Zoe announced that she wanted to have a nap. I put her to bed, and she probably napped for about 2 and a half hours. It's been a while since I've had nap time to put my feet up, so I used the time to sort through all of the photos from the sports day and Kinderdance. I should have gone through the photos from her birthday party too, but I forgot.

By the time Zoe resurfaced and had some afternoon tea, there wasn't a lot of time left in the day. I had to be available for someone to come and service the building's hot water heater, so we couldn't go out and do any pre-holiday trip shopping.

Sarah arrived to pick up Zoe for the weekend, and that was pretty much it.

That's the end of Kinderdance now. Next term, Zoe's going to try tennis as her extracurricular activity.

Linux Users of Victoria (LUV) Announce: LUV Main July Meeting: SKA and Linux and Innovation Software Patents

Fri, 2014-06-27 14:29
Start: Jul 1 2014 19:00 End: Jul 1 2014 21:00 Start: Jul 1 2014 19:00 End: Jul 1 2014 21:00 Location: 

The Buzzard Lecture Theatre. Evan Burge Building, Trinity College, Melbourne University Main Campus, Parkville.

Link:  http://luv.asn.au/meetings/map

Ewan Barr, Linux and the Square Kilometre Array

The Buzzard Lecture Theatre, Evan Burge Building, Trinity College Main Campus Parkville Melways Map: 2B C5

Notes: Trinity College's Main Campus is located off Royal Parade. The Evan Burge Building is located near the Tennis Courts. See our Map of Trinity College. Additional maps of Trinity and the surrounding area (including its relation to the city) can be found at http://www.trinity.unimelb.edu.au/about/location/map

Parking can be found along or near Royal Parade, Grattan Street, Swanston Street and College Crescent. Parking within Trinity College is unfortunately only available to staff.

For those coming via Public Transport, the number 19 tram (North Coburg - City) passes by the main entrance of Trinity College (Get off at Morrah St, Stop 12). This tram departs from the Elizabeth Street tram terminus (Flinders Street end) and goes past Melbourne Central Timetables can be found on-line at:

http://www.metlinkmelbourne.com.au/route/view/725

Before and/or after each meeting those who are interested are welcome to join other members for dinner. We are open to suggestions for a good place to eat near our venue. Maria's on Peel Street in North Melbourne is currently the most popular place to eat after meetings.

LUV would like to acknowledge Red Hat for their help in obtaining the Buzzard Lecture Theatre venue and VPAC for hosting, and BENK Open Systems for their financial support of the Beginners Workshops

Linux Users of Victoria Inc., is an incorporated association, registration number A0040056C.

July 1, 2014 - 19:00

read more

Andrew Pollock: [life] Day 148: Car washes, play dates and haircuts

Thu, 2014-06-26 22:25

We had one of those comfortably full days today.

Zoe slept really well last night, almost 12 hours. Her cough seems to be markedly better in terms of frequency, but it still sounds pretty bad when she does cough.

We had a leisurely start to the day, and went to the car wash first. Hoppy's Handwash Cafe is a far cry from Lozano's brushless Car Wash (which doesn't even appear to run to a website, it's so low budget). Hoppy's by comparison costs the bomb, but is quite the fancy establishment, with iPads littered all over the place for your (or in my case, your kid's) entertainment, while a display informs you of the progress of your car being washed. It also features a mid-range cafe. Hey, they have babyccinos. I discovered today that they even have some sort of "gun" where you can shoot something at the cars as they travel along the conveyor belt. Not sure if shooting at the staff is encouraged.

Zoe discovered all the windows today as we were trying to leave, so we had to spend some extra time watching how the sausage was made car was washed.

On the way home, we picked up some stuff from the Hawthorne Garage to make guacamole. I forgot the tomato, so we had to walk back once we got home.

Zoe's friend Frankie from Kindergarten was coming for lunch, with her Mum Zhenya and little brother Hardy. Hardy was a bit knackered after his swim class, so they ended up coming an hour later than planned, but we killed the time watching Swedish Chef videos on Youtube (Zoe's idea).

Frankie and her Mum and brother arrived for lunch, and I whipped up some chicken quesadillas to go with the guacamole. The kids all had a great time playing after lunch. Today I learned about cardboard box rivets from Zhenya, so I can see some of them in our future.

Zoe and Frankie did a spot of baking after lunch, and then they headed off.

I managed to book in haircuts for both of us in the afternoon, so after a bit of a clean up, we walked to the hairdresser and got our haircuts and then walked home again.

I was feeling lazy, so we had some frozen leftovers for dinner (the real excuse is the dishwasher was still going and the Thermomix bowl was in it).

I got Zoe to bed on time without much of a peep.

Michael Fox: Farewell Bindi

Thu, 2014-06-26 21:26

Today my wife and I had to say farewell to one of our two dogs. Below is a picture of Bindi from lastnight, as always she would be laying on the floor in the home office while I would be doing what it was I had to do. She would always do that, even from when she was a pup.

Bindi was a very loyal friend and would do everything you would tell her. She was a great dog, and will be missed a great deal. She lived a good life and we got to spend 11.5 years with her.

Farewell Bindi, you’ll be forever in our hearts and in our thoughts always. Buddy will miss you and I am sure he will not forget you either, you’ll both meet up with each other again in the future.

Bindi

(12th May 2013): I should add that the issue was a toe tumor. To my surprise based on some recent research this seems to be very common. Something I wasn’t even aware of at the time. Bindi lost her nail several months back, could of been even longer. I do not remember when, just remember it happening and thought nothing of it. But I do believe this nail coming out was probably the linked item to the whole saga. I also remember her limp from time to time, I would check her foot for something caught and find nothing. She would again walk normal. I believe this condition was also related to the tumor in her toe too. Events that I didn’t link until now.

Michael Fox: Backyard Drainage Progress

Thu, 2014-06-26 20:26

Finally got a bit of time in the afternoon today to do more work on the drainage in the backyard. When we got all that rain the other month it highlighted the fact we now needed to do a bit more to allow the excess water to escape, so I started planning to fix the issue or at least make it bearable.

Managed to cut into the main storm water overflow line to the street and put in a junction and tee (used a collar to take up the difference, so that I could insert the new items from the pipe section that was removed), so I could put a surface drain above the tee. I am going to use this surface drain to sit just below existing surface line and insert the rain water tanks hose that drips during the first part of rain into the drain.

You can see the pictures below;

The fabric over the drain is only for the moment, so I don’t spill soil and other material back in it as I back fill it. I am also going to add another surface drain where it meets the pergola too. So I will break the arg line and insert a tee etc.

Michael Fox: Backyard drainage progress – Update 2

Thu, 2014-06-26 20:26

Yesterday since I had to look after the kids for the day, I decided to do more work in the backyard with the drainage. The aim was to setup the drains and back fill with blue metal. As you can see below it came up very good.

Next step is to now back fill with some soil so that we can cover over the area with some other material, as we will be moving the kids big trampoline back to this spot as it won’t be a grassed area any more.

I put the hose in the last drain and left it running for a bit and like my previous test the water will hit the junction and go into the storm water line that goes to the street. So the water naturally finds the path along the trench in which I now have the arg line laid and covered it with blue metal.

Michael Fox: Big W – Total Toy Domination Sale

Thu, 2014-06-26 20:26

The Big W – Total Toy Domination Sale started midnight today, and in true fashion my wife was well prepared. She had already made a list of everything she needed to get and had it written all out along with the prices and page numbers from the catalog.

She left the house at 11:30pm last night to go queue up for opening and was home again by 2:00am today, slept a few more hours and went to work as usual.

It paid off, as she managed to get all the major items that she required, and we decided as a joint present for the kids this year we’d get a Wii U. As our kids love playing the Wii U that our nephew has, so we thought this would be a wicked surprise.

The catalog had a opening special on the Limited Edition – Skylanders Swap Force Basic Set for $198 with 3 additional Skylanders Figures. Not a fan of Skylanders, but bought it due to the cheaper price for the console.

Michael Fox: The many plates from Carnival Spirit Voyage S416

Thu, 2014-06-26 19:26

Our family just recently got back from a cruise on the Carnival Spirit, which was Voyage S416 that set sail from Sydney on May 10th, it returned on the May 18th.

Below is a number of photos of all the plates of food that was consumed during that period. Sometimes my wife and I had different meals, so we could get a good look across the menu.

Totally enjoyed it, hope everyone enjoys the photos. Next time I will document on a pad what I had, so I can name all the meals.

 

Ben Martin: Atmel Atmega1284

Thu, 2014-06-26 10:25
I started tinkering with the Atmega1284. Among other things it gives you an expansive 16kb of SRAM, 2 uarts and of course looking at the chip a bunch more IO. A huge plus is that you can get a nice small SMD version and this 40 pin DIP monster with the same 1284. Yay for breadboard prototypers who don't oven bake each board configuration! The angle of photo seems to include the interesting bits. Just ignore the two opamps on the far right :)





I had trouble getting this to work with a ceramic resonator. The two xtal lines are right next to each other with ground just above but the 3 pins on the resonator were always a bit hard to get into the right configuration for these lines. Switching over to a real crystal and 22pF caps I got things to work. The symptoms I was having with the resonator included non reproducibility, sometimes things seemed to upload sometimes not.  Also, make sure the DTR line is going though a cap to the reset pullup resistor. See the wiring just to the right of the 1284.



I haven't adapted the Arudino makefile to work on this yet, so unfortunately I still have to upload programs using the official IDE. I have the makefile compiling for the 1284 but das blinken doesn't work when I "make upload".



Andrew Pollock: [life] Day 147: Kindergarten end of term 2 and cleaning

Wed, 2014-06-25 20:25

This morning was abnormally crazy on account of yesterday's sick day for Zoe.

I picked up Zoe from Sarah to take her to Kindergarten on account of not having done it yesterday, but I couldn't head over there until after my 8am chiropractic adjustment. That worked out okay in the end, because Zoe slept in anyway.

I didn't get Zoe to Kindergarten until around 9am, and I had volunteered to put a written communication from the PAG into all of the childrens' notice pockets, as well as a couple of other things that the Director asked me if I could do.

That involved folding two out of the three pieces of paper and putting it in 88 pockets. It took me about an hour. It was nice to be able to eavesdrop on the normal Kindergarten chatter though. I'll have to try and spend a full day at the Kindergarten as a parent helper next term.

Zoe's cough seems to have improved somewhat. No idea if that's as a result of the inhalers or she's just getting over whatever illness she may have.

After I finally got home, I did a bit of cleaning before my massage. I wasn't sure if I'd get the cleaning finished before I had to be back at Kindergarten for pick up, so I lined up a play date with Megan's Dad for after Kindergarten. In the end I managed to knock out the bulk of the cleaning before 2pm, so it was all good, but I still went with the play date anyway, as it let me finish things off properly.

I picked up Zoe from Megan's house, and after a cup of tea with Jason we headed home.

I managed to get dinner and bath time time pretty early, so I put Zoe to bed half an hour early. Based on what Sarah's told me, she's started coughing at around 4:30am, so it'll be interesting to see how she goes overnight, and if anything correlates with room temperature.

Russell Coker: Fixing Strange Directory Write Access

Wed, 2014-06-25 13:26

type=AVC msg=audit(1403622580.061:96): avc:  denied  { write } for  pid=1331 comm="mysqld_safe" name="/" dev="dm-0" ino=256 scontext=system_u:system_r:mysqld_safe_t:s0 tcontext=system_u:object_r:root_t:s0 tclass=dir

type=SYSCALL msg=audit(1403622580.061:96): arch=c000003e syscall=269 success=yes exit=0 a0=ffffffffffffff9c a1=7f5e09bfe798 a2=2 a3=2 items=0 ppid=1109 pid=1331 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="mysqld_safe" exe="/bin/dash" subj=system_u:system_r:mysqld_safe_t:s0 key=(null)

For a long time (probably years) I’ve been seeing messages like the above in the log from auditd (/var/log/audit/audit.log) when starting mysqld. I haven’t fixed it because the amount of work exceeded the benefit, it’s just a couple of lines logged at every system boot. But today I decided to fix it.

The first step was to find out what was going on, I ran a test system in permissive mode and noticed that there were no attempts to create a file (that would have been easy to fix). Then I needed to discover which system call was triggering this. The syscall number is 269, the file linux/x86_64/syscallent.h in the strace source shows that 269 is the system call faccessat. faccessat(2) and access(2) are annoying cases, they do all the permission checks for access but don’t involve doing the operation so when a program uses those system calls but for some reason doesn’t perform the operation in question (in this case writing to the root directory) then we just get a log entry but nothing happening to examine.

A quick look at the shell script didn’t make the problem obvious, note that this is probably obvious to people who are more skilled at shell scripting than me – but it’s probably good for me to describe how to solve these problems every step of the way. So the next step was to use gdb. Here is the start of my gdb session:

# gdb /bin/sh

[skipped]

Reading symbols from /bin/dash…(no debugging symbols found)…done.

(gdb) b faccessat

Breakpoint 1 at 0×3960

(gdb) r -x /usr/bin/mysqld_safe

[lots skipped]

+ test -r /usr/my.cnf

Breakpoint 1, 0x00007ffff7b0c7e0 in faccessat ()

from /lib/x86_64-linux-gnu/libc.so.6

After running gdb on /bin/sh (which is a symlink to /bin/dash) I used the “b” command to set a breakpoint on the function faccessat (which is a library call from glibc that calls the system call sys_faccessat()). A breakpoint means that program execution will stop when the function is called. I run the shell script with “-x” as the first parameter to instruct the shell to show me the shell commands that are run so I can match shell commands to system calls. The above output shows the first call to faccessat() which isn’t interesting (it’s testing for read access).

I then ran the “c” command in gdb to continue execution and did so a few times until I found something interesting.

+ test -w / -o root = root

Breakpoint 1, 0x00007ffff7b0c7e0 in faccessat ()

from /lib/x86_64-linux-gnu/libc.so.6

Above is the interesting part of the gdb output. It shows that the offending shell command is “test -w /“.

I filed Debian bug #752593 [1] with a patch to fix this problem.

I also filed a wishlist bug against strace asking for an easier way to discover the name of a syscall [2].

Related posts:

  1. Tracking down Write/Execute mmap() calls with LD_PRELOAD One of the access controls in SE Linux is for...
  2. How not to write the way dumb people think smart people write Don Marti has written an amusing and informative little post...
  3. Fixing execmod (textrel) Problems in Lenny I’ve just updated my repository of SE Linux related packages...

Matt Palmer: Moving forward with an SSL Co-op

Wed, 2014-06-25 10:26

Since first posting my idea for an SSL co-op a couple of weeks ago, I’ve gotten some positive feedback from people, and further thinking and research has convinced me that it is feasible to at least attempt it.

As a result, I’d like to announce the public unveiling of The SSL Co-op. It is intended to be a commercial, not-for-profit1 organisation that issues widely-trusted certificates to members, for their use or for resale. Eventually, I’d like the co-op to be a root CA in its own right, with its certificate trusted by all the browsers and other X.509-using applications out there, but that isn’t something that’s achievable immediately.

At this stage, the co-op hasn’t been formed, and I’m looking for expressions of interest from individuals and organisations who would be interested in becoming members. If you fit that description, I’d really appreciate it if you could fill out a short survey so I can get a better idea of what sort of scale the co-op will be operating at initially.

This is the first step towards an interesting future, where there is more choice of provider for online identity verification. Exciting times.

  1. Despite a lot of misunderstanding to the contrary, “commercial, not-for-profit” is not a contradiction. “Commercial” means “doing things for money”, and “not-for-profit” means “not returning a dividend to investors”. In the case of the SSL co-op, it will be providing services to members on a cost-recovery basis, and any excess funds left over from that will be re-invested in the co-op to improve the services provided to members.

Lev Lafayette: ACIP Review of Innovation Patent System: No Software Patents!

Tue, 2014-06-24 21:29

The final report of the ACIP (Australian government Advisory Panel on Intellectual Property) review of the Innovation Patent System came out today.

http://www.acip.gov.au/reviews/all-reviews/review-innovation-patent-system/

The good news is that ACIP have recommended that "no method, process or system shall be patentable".

THIS MEANS NO SOFTWARE PATENTS

Selections from the Report follow. I note that they referred to several of the examples were included in the LUV submission.

read more

David Rowe: Energy Equivalents of a Krispy Kreme Factory

Tue, 2014-06-24 19:29

My 15 year old son is rather excited at the prospect of Adelaide’s first Krispy Kreme factory. This factory will be pumping out 5,000 donuts an hour.

Now a donut contains about 1000 kJ of energy. This is chemical energy, in the form as fat and sugars and carbohydrates. Our bodies are designed to “burn” this chemical energy and use it to run our bodies. If we don’t need any more energy when we consume to donut, then some of it the excess will be stored as fat. Energy can come in different forms, such as electricity, mechanical, or potential energy.

Energy is measured in Joules (J), lots of energy in kilojoules (kJ), or megajoules (MJ). Power is the rate we use (or produce) energy. If I use 1 J/s in my LED torch, that is 1 Watt (W). My electric car uses 5 kW when I cruise along at 60 km/hr. So 5,000 J/s is moving from my batteries to the electric motor of the car.

The average human uses 8700 kJ per day. That means we need to injest roughly 8700 kJ of energy, and our body uses about the same amount of energy. This energy runs our body, and gives us some energy for moving about. There are 24(60)(60) seconds in a day. So the power consumption of the average human (energy/second) is 8,700,000J/(24(60)(60))=100W. about the same as a large incandescent light bulb.

So as we know the energy in a donut, and the rate at which the donuts are produced, we can measure the Power Output of the Krispy Creme factory. Then compare that to all sorts of other power producers and users in our lives.

Here are a few energy equivalents (spreadsheet):

More

A related analysis is Fuel Consumption of a Pedestrian Crossing.

Andrew Pollock: [life] Day 146: A unexpected Zoe-free day, and lots of startup stuff as a result

Tue, 2014-06-24 19:25

Zoe apparently coughed all night last night, so Sarah decided to keep her home from Kindergarten today. We had a bit of a chat this afternoon about whether or not it could be asthma, and have set up a shared diary to keep track of her symptoms for a while.

I got stuck into my real estate course today, and finished off the final bit of assessment that has been dogging me for one module, and completed another module and its assessment, and am half way through the next module after that.

Smudge had her annual check up from the vet. Dr Anthony came out this time, and he was really lovely. He spent about 45 minutes here, and gave Smudge a very thorough examination and a vaccination. I'm really impressed by their service. It beats trying to wrangle a cat in the car to the vet. It was too bad that Zoe wasn't here this afternoon, because I thought she would have enjoyed watching.

I also finally managed to get some traction talking to Origin Energy about getting the building's hot water heater replaced, so hopefully cold showers in the morning will soon be a thing of the past. The state sales manager for retrofits came out and talked to me and looked at the plant and is going to send through a proposal soon.

I've moved my fortnightly evening yoga class to Tuesdays to better fit in with Anshu's amateur theatre schedule, so I'm looking forward to topping off a productive day with a good yoga session.

Michael Fox: First post for new personal site

Tue, 2014-06-24 17:26

I’ve decided to delegate my long running domain heimic.net into a personal site for my family and I. The content moving forward against this site will be non technology.

Technology related posts have been moved to my alternative domain heimic.com, which in the longer term will make sense why I have done this change.

 

Brendan Scott: brendanscott

Tue, 2014-06-24 11:29

They say there is no evidence one way or the other about the usefulness of the innovation patent system.  Seem a little annoyed that so many people said to remove software patents.

Details here.



David Rowe: HF Modem Frequency Offset Estimation

Tue, 2014-06-24 07:29

One of my goals for 2014 is to make FreeDV work as well as SSB on HF radio channels. Recently I have been working on improvements to the frame sync algorithms used in the FDMDV modem. I would like to move from a “hard” sync decision to a “soft” one, such that the demod can track through fades. Often during a fade our signal is still there, so it’s better to wait around a bit than go off trying to find a new one. There is a trade off between remaining “in sync” and tracking through a fade and syncing up quickly when a new FreeDV signal appears.

Frame sync relies on the coarse frequency offset estimation algorithm, that works out the centre frequency of the modem signal is in the receivers passband. The nominal centre frequency is 1500 Hz. An offset of 100 Hz would mean the centre frequency is actually 1600 Hz. We need to know the offset within a few Hz for the demod to work properly. If we don’t get the frequency offset right, the demodulator outputs garbage, so no decoded speech. If the frequency offset estimation jumps about, the decoded speech will stop and start.

Frequency Offset Estimation in Action

The frequency offset estimation algorithm works by multiplying (mixing) the incoming signal with a noise free copy of the expected BPSK pilot signal. We then take the FFT of the resulting signal, and peak pick. On a good day, this will have a peak corresponding to the frequency offset. We then usually apply some post processing logic to correct the inevitable errors.

Here it is in action for a 0dB SNR AWGN channel with a -50Hz frequency offset. It’s a weak signal. First a spectrogram of the signal at the input of the demodulator, then a spectrogram of the output of the mixer (note -50Hz line), then a plot of four frequency offset estimates. The x axis in all plots is time, one frame is 20ms, 50 frames 1 second.

The four frequency offset lines “foff_xxx” above show firstly the “raw” output from peak picking the FFT, then the output from three different post processing algorithms. While all but the foff_thresh line look OK here, in practice they all have there pros and cons, none are completely reliable.

Here are the same plots on the nasty HF fading channel. You can see gaps in the pilot just under 1500Hz, which leads to the “dotted” -50Hz line on the mixer output spectrogram. The raw frequency offset estimate is all over the place, although it does get cleaned up by the post processors. Note the foff_state and foff_thresh plots take a long time to lock up, e.g. foff_thresh doesn’t jump to -50Hz until quite late in the simulation, and foff_state takes more than 1 second (50 frames).

Automated Tests

I’ve written a Unit Test (UT) in Octave called fdmdv_ut_freq_est.m that can perform automated tests of various channel conditions:



Test 3: 30 Seconds in HF multipath channel at 0dB-ish SNR

  Channel EbNo SNR(calc) SNR(meas) SD(Hz) Hits Hits(%) Result

    AWGN  3.00  0.78      1.18     22.00   200  100.00  PASS

 

Test 3: 30 Seconds in HF multipath channel at 0dB-ish SNR

  Channel EbNo SNR(calc) SNR(meas) SD(Hz) Hits Hits(%) Result

      HF  3.00  0.78      1.71     87.36   188  94.00  FAIL

The UT also generates the plots above to help me debug the frequency offset estimation algorithm.

Mesh Plots

I discovered that mesh plots were an interesting alternative to spectrograms for plotting signals in 3 dimensions such as time, frequency, and amplitude. On Octave, the mouse can be used to rotate the view of the mesh plot to view it from different angles. Here are some animated videos generated by Octave that illustrate the effect.

The first video is the modem spectrum, with a SNR of 10dB, in an AWGN channel. You can see the central “fin” which is the high energy BPSK pilot. Looks like a toaster! Note the slope from 0 to about 10 frames as the filter memories in the modem “fill up” from the all-zero state at start up.

The second video is the output of the frequency offset estimation mixer. Note the “blade” along the -50Hz line. This is the peak we are looking for.

The third video shows the mess the HF fading channel makes of the modem signal. Deep notches appear, and also some peaks, higher than the signal in the AWGN channel. I wonder if these peaks (short regions of high SNR) they can be used? As the mesh is rotated so it is flat, we get a form of the 2D-colourmap spectrogram.

This command line was used to generate the animations from the PNGs generated by Octave:



david@bear:~/tmp/codec2-dev/octave$ mencoder mf://*.png -mf w=640:h=480:fps=5:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o freq_est.mp4

Conclusions

I’m not quite happy with the frequency offset estimation algorithm. It still occasionally fails when the BPSK pilot is wiped out completely by a fade. Not quite what I want for the HF channel. Now that I’ve written it up here, I will take a break while I work on the SM1000 code, and come back to frequency offset estimation later.

I’d also like to try FreeDV with no frequency offset estimation. In a way, it’s just another algorithm that can go wrong in fading channels. Without it, the operator would need to tune the receiver to within say 10% of the symbols rate, e.g. 0.1(Rs) = 0.1(50) = 5Hz. But many SSB operators do that anyway. If a higher symbol rate was used, say Rs=200Hz, it’s +/- 20Hz. If we disable frequency offset estimation, we could lose the pilot, saving 1.2dB of SNR, 150Hz of bandwidth, and reducing Peak to Average Power Ratio (PAPR). It could also be a switch-able option, manually disabled by the operator for low SNR channels.

Andrew Pollock: [life] Day 145: Kindergarten, random stuff and looking after Charlie

Mon, 2014-06-23 22:25

Zoe woke up a bit early this morning at 5:38am. We snuggled in bed for a while, but I don't think there was any more sleep.

She's been coughing constantly since yesterday, and I took her to school in the car to keep her out of the cold air. I debated whether to send her at all, but she was in good spirits, and we had to bring Charlie home after Kindergarten.

I had a call with the Family Relationship Centre at 9:30am, and so I mostly faffed around until that happened, and then felt pretty listless afterwards, so I didn't get a whole lot of anything significant done today. I did pull together some numbers needed to file what I expect to be my last FBAR. That is one thing I will most definitely not miss about having any connection with the US.

I'd offered to help out Charlie's parents, Odette and Julian, while their daughter with cystic fibrosis was in hospital for treatment, by picking up Charlie after Kindergarten. Today was a day they took me up on the offer, so Charlie came home with us. I keep thinking of Charlie bit my finger.

He was fine with the whole thing, despite not having really had much to do with me prior to today. The most complicated part of the whole thing was trying to get his car seat into my car. He seemed quite excited to be coming home with Zoe. I might need my shotgun sooner than I thought.

I was a bit unsure of how to entertain a boy, but he was pretty easy going. He was happy to pat Smudge and follow Zoe around. They were pretty quiet in her room, and when I looked in on them, they were sitting on the bed together and Charlie was watching Zoe play a game on her tablet.

They did a bit of painting together, and then I busted out the Kinetic Sand, which hasn't seen any use for months, and that kept them occupied for a good amount of time. They watched a little bit of TV and then Julian arrived to pick him up. It was all pretty easy really.

I managed to get Zoe a doctor's appointment that dovetailed nicely with the afternoon's schedule, so we headed over to see him. He said her chest sounded clear. For the last couple of doctor's visits there's been a lot of talk about asthma, given I had it as a child. He prescribed her a Flixotide inhaler. It's just so hard to tell if it's asthma, or a post-nasal drip-related cough that's hanging around. I'm a bit paranoid about letting an untreated cough go for too long lest it wind up being bronchitis.

Since we were already out in the car, I dropped Zoe around to Sarah's place.