True's beaked whale.jpg

Western spotted skunk

Hooded skunk

Yellow-throated Marten

Wolverine

Archive for the ‘howto’ Category

Using cron to mute sound in Ubuntu 20.04

Wednesday, August 18th, 2021

I wanted to turn off audio at night automatically using cron.

I saw suggestions to use amixer:
export DISPLAY=:0 && /usr/bin/amixer -D pulse sset Master,0 0%
but this gave an error:

ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused
amixer: Mixer attach pulse error: Connection refused

This works, add this line to /etc/crontab:

* 23<tab>* * *<tab>jiml<tab>DISPLAY=:0.0 pactl --server unix:/run/user/1000/pulse/native set-sink-mute @DEFAULT_SINK@ true

and restart cron:
service cron restart

jiml is the user with the open desktop.
‘1000’ is the uid of user ‘jiml’, this can be found by:

ls /run/user
or
id -u jiml

and restart cron:
service cron restart


jiml is the user with the open desktop.
‘1000’ is the uid of user ‘jiml’, this can be found by:

ls /run/user
or
id -u jiml

Modding a Sunbeam heating pad

Friday, November 21st, 2014

I bought a Sunbeam heating pad. It has low/med/high settings, and turns off after two hours.
heating pad

The back of the controller says ‘Sunbeam SLA103’.

I wanted to eliminate the shutoff, I’m using it to heat my fermentation bucket.

(more…)

HTML5 app developement info

Friday, January 27th, 2012

PhoneGap: a native app wrapper for HTML5 apps
Windows 7 HTML5 app example using PhoneGap
HTML5 iPhone app example
HTML5 app intro

HTML5 info canvas
HTML5 demos and browser support list

Usbpicprog

Sunday, January 8th, 2012

Built a USB PIC microcontroller programmer, the usbpicprog. I used Marcelo Maggi’s version with daughter boards for the USB and ZIF. The boards had some narrow traces–I had two small defects after eteching, and lost a few more pads soldering the components on. Small wires fixed things up and it worked first time.

The instructions aren’t very clear. The bootloader .hex gets burned using a JDM programmer using the self programmer header. Then place a jumper on the self programming header Vpp and Vdd, plug it into the USB port, run usbpicprog. These messages appear on the command line:
Bootloader Devid: 11240
Autodetected PIC ID: 0x11240

Then open the firmware .hex and burn it. The program said it completed OK. Then quit the program, remove the USB cord, and add a second jumper on the self programming header from the Clk pin to Gnd.

After this it I connected my PIC18F46K20 to the ICSP header (on a breadboard), plugged in the USB cable, and ran usbpicprog again. I opened my .hex and burned it. It said the code burned OK but gave an error for the configuration bits (like I was getting from the JDM programmers). Then I tried erasing it followed by running blank check. Both of these completed OK. I re-burned my program, and this time it worked! Configuration bits were programmed and verified!

So far I’ve only finished the main board. I made the USB board but haven’t populated it yet. I intend this mainly for ICSP programming, so I haven’t decided on whether to make the ZIF board. I do need to make an enclosure.

usbpicprog top side
usbpicprog bottom side
You can see some of the trace repairs.

JDM programmer

Sunday, January 8th, 2012

Here’s a JDM programmer for PIC microprocessors that works for me.

circuit board
circuit
docs

I used it to put the bootloader on a usbpicprog PIC programmer I am building. It also programmed my PIC18F46K20. It worked with picpgm and picprog on Linux. Picprog still gave me config bit errors.

I have tried other JDM programmers–simpler ones using no transistors like Simple JDM programmer (though with not-quite-right zeners). It worked intermittently for a while, then stopped working altogether on my PIC18F46K20.

Here’s a JDM programmer that usbpicprog recommends. I haven’t tried it.

JDM prog breadboard

Etching circuit boards

Friday, December 16th, 2011

Note to self: on my HP LaserJet6L, board traces printed from Eagle using the PS device need to be printed out at 110%.

GPS tracker

Tuesday, October 12th, 2010

A small GPS tracker able to report its position would be useful. It could be used as a LoJack style property tag. There are a number of ways to do this of varying difficulty and expense.

GPS modules are fairly inexpensive, selling for $50-100. The harder part is communications. There are three main ways to have a GPS report its postion: 1) cell phone text messages, 2) radio, or 3) using open wireless internet nodes. 3) is unreliable, there may not be a open access point where it is needed. 2) is hard–the way it would work is to have a radio transmitter with a 1 to 10 mile range send location info through a ham repeater onto the internet. This requires a ham license and roughly $100 for the controller and radio electronics.

The easiest way turns out to be 1). In fact, there are cell phones available that have GPS and of course text message and/or data capability. Some of these phones allow the phone to run custom software. And in fact, groups have written this software already.

One is TrekBuddy. It can be combined with a cheap cell phone with GPS. Using a prepaid phone, the cheapest plans are about $0.20 – $0.35 a day, about $6 – $11 a month.

There is also Mologogo, a site with a custom tracking app that sends data to the mologogo.com site and displays the position on a map.

Other similar services:
iTag
InstaMapper
AccuTracking

Downloading flash video

Tuesday, October 12th, 2010

How to download flash video.

Try the UnPlug Firefox extension first. If it works it is the easy way.

If that doesn’t work, here’s a way of downloading flash video.

1) Install tshark, a network monitoring tool.

2) Run tshark from a command line:
tshark -e http.host -e http.request.uri -T fields tcp port 80 > sites.txt

3) Load or reload the web page with the flash, let the video start to play. Then you can stop tshark.
tshark logs all the files that get called to load the web page.

4) Look in the sites.txt file. Search for files with the .flv extension:
flash.video.worldnow.co /wand/WAND_20101010210218823AB.flv

Put together the web site and file path like so (the ‘m’ in com was cut off):

5) Download this file. I use wget:
wget http://flash.video.worldnow.com/wand/WAND_20101010210218823AB.flv

6) The file can be viewed with a flash video player (like VLC) or converted to .avi with ffmpeg:
ffmpeg -i WAND_20101010210218823AB.flv video_file.avi