Friday, 22 January 2010

MythTV - DSTV Channel Changer

LIRC

So the first step was to get LIRC up and running on Mythbuntu; this was quite easy as the default installation do enable lirc, I only selected " Enable an IR Transmitter" and selected a bogus Serial lirc device.

ir tx

This created all the relevant configuration files.

I then searched the net for the lircd.conf (remote command reference file) for my spesific decoder

digsat_uec-dsd-820_thb(DSD820 aka DSTV DualView Decoder).

 I did not find the spesific file but found one for the UEC DSD910 decoder.

digsat_uec-dsd-990_thb

The DSD910 remote file (general.conf):

#
# this config file was automatically generated
# using WinLIRC 0.6.5 (LIRC 0.6.1pre3) on Wed Sep 10 15:36:20 2003
#
# contributed by Guy Antony Halse <guy-lirc@rucus.ru.ac.za>
#
# brand:             Multichoice
# model:             DSD910
# supported devices: Digital Satellite Decoder (DSTV Decoder)
#
# Multichoice is a South African Satellite TV company offering their
# own branded decoders.

begin remote

  name  dsd910

  bits           13
  flags RC5|CONST_LENGTH
  eps            30
  aeps          100

  one           962   808
  zero          962   808
  plead         992
  gap          113485
  toggle_bit      2
      begin codes
          power                    0x000000000000160C
          red                      0x000000000000162C
          green                    0x000000000000162B
          yellow                   0x000000000000162A
          blue                     0x000000000000162E
          1                        0x0000000000001601
          2                        0x0000000000001602
          3                        0x0000000000001603
          4                        0x0000000000001604
          5                        0x0000000000001605
          6                        0x0000000000001606
          7                        0x0000000000001607
          8                        0x0000000000001608
          9                        0x0000000000001609
          0                        0x0000000000001600
          radio                    0x0000000000001625
          tv                       0x000000000000162F
          mute                     0x000000000000160D
          teletext                 0x0000000000001624
          information              0x000000000000162D
          up                       0x0000000000001612
          left                     0x000000000000161D
          ok                       0x0000000000001622
          right                    0x000000000000161E
          down                     0x0000000000001613
          menu                     0x000000000000161C
          exit                     0x0000000000001631
          tvguide                  0x0000000000001635
          progup                   0x0000000000001620
          progdn                   0x0000000000001621
          volup                    0x0000000000001610
          voldn                    0x0000000000001611
      end codes

end remote
 

This file was copied to the relevant directory in /var/lib/cache/lirc/....

The next step was to change the config in /etc/lirc/hardware.conf

#Chosen IR Transmitter
TRANSMITTER="dsd910"
TRANSMITTER_MODULES="lirc_dev lirc_serial"
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE="/dev/lirc0"
TRANSMITTER_LIRCD_CONF="dsd910/general.conf"
TRANSMITTER_LIRCD_ARGS=""

After that I started the lirc again:

sudo /etc/init.d/lirc start

This was then tested with the following command:

sudo irsend SEND_ONCE dsd910 information

This worked and showed the "information banner".
This was tested on TV1.

Still to do is to  add and test TV2 ir and to enable a change channel script in Mythbuntu.

Thursday, 14 January 2010

Bind Dynamic DNS Updates

I saw a request to update Bind via a command line rather than Webmin for the ease and speed of a command line; So I embarked on investigating this.

Firstly it seems that there is not a lot of dynamic update or command line update scripts available or the people just don't want to share ???

I stumbled across nsupdate, an application that is part of the Bind suite.
This is a command line tool to add dynamic updates to an DNS server.

for this to work you need to update the specific zone file with at least the following configuration:

zone "example.com" {
type master;
file "/etc/bind/example.com.hosts";
allow-update {192.168.0.0/24; };
journal "/var/lib/bind/example.com.hosts.jnl";

};
For dynamic DNS you need:
allow-update
journal

then to add an entry to the DNS server:
from within the 192.168 ip range :

user@pc:~$ nsupdate
> zone example.com
> update add guest1.example.com. 86400 A 192.168.0.10
> send
> quit

your syslog on your DNS server will log all updates

Tuesday, 15 December 2009

Mythbuntu - BTTV Driver

The following settings woked for my PowerColor BT878 capture card:

lspci
04:00.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
04:00.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)

And the settings:
rmmod bttv
rmmod tuner
sudo modprobe bttv card=70 tuner=1



Wednesday, 9 December 2009

Can't ping FQDN in Ubuntu

I created a local DNS zone ending in .local and experienced weird DNS behaviour; dig worked 100%

It seems the avahi-daemon interferes with the normal resolving process. It’s DNS caching borks the normal functionality

The fix:


# shut it down
sudo /etc/init.d/avahi-daemon stop
# stop it starting at the next reboot by removing the startup links
sudo update-rc.d -f avahi-daemon remove
Removing any system startup links for /etc/init.d/avahi-daemon ...
/etc/rc1.d/K86avahi-daemon
/etc/rc2.d/S50avahi-daemon
/etc/rc3.d/S50avahi-daemon
/etc/rc4.d/S50avahi-daemon
/etc/rc5.d/S50avahi-daemon


Sunday, 1 November 2009

Cacti - Mikrotik Signal Strength Graph for client connection

[caption id="attachment_174" align="aligncenter" width="603" caption="cacti signal strength graph"]cacti signal strength graph[/caption]

Well it took me some time and confusion to get this graph going; at the end of the day it was a configuration error and the misuse/confusion between different templates found on the net.

In summary this is the correct parameters:

Cacti version: 0.8.7e
Mikrotik Router OS: 4.2

Device:

  • Added device with SNMP v1 & Mikrotik Template

  • Make sure the Associated Data Queries - Mikrotik - Wireless - Client is working.


Data Sources:

  • Selected Data Template - Mikrotik - Wireless - Signal Strength ( NOT Mikrotik - Wireless - RegTable Signal Strength)

  • Custom Data - Index Value - This is the numerical value (e.g. 4) corresponding to the wireless interface index id you want the signal strength measured for.

  • Custom Data - Index Type - ifIndex


Data Queries:

  • Use the Mikrotik - Wireless - Client data query located at <path_cacti>/resource/snmp_queries/mikrotik_wireless_client.xml and make sure the Data input method is: Get SNMP Data (indexed)


That should do the trick.

Where did I go wrong:

I had to add a new device for this to work, but once working I could duplicate the graph and associate it with the correct device. - don't know if this is a cacti bug or not?

I used the RegTable signal strength data template in error

Wednesday, 21 October 2009

LNB

Well after some investigation it was found that a LNB don't last forever and can be an piece of equipment that can give you a lot of headacke

Dual polarisation LNBs


The LNB shown above has one wire going into the waveguide to pick up vertical polarisation. If the input waveguide is circular is can support two polarisations and it can be arranged for there to be two input probes at right angles, thus allowing two alternative polarisations to be selected (vertical or horizontal), either one or the other. Dual polarisation LNBs may commonly be switched remotely using two alternative DC supply voltages. e.g. 13 volts makes it receive vertical polarisation and 19 volts make it receive horizontal polarisation.


LNB supply voltages


The DC voltage power supply is fed up the cable to the LNB. Often by altering this voltage it is possible to change the polarisation or, less commonly, the frequency band. Voltages are normally 13 volts or 19 volts. Perfect weatherproofing of the outdoor connector is essential, otherwise corrosion is rapid. Note that both the inner and outer conductors must make really good electrical contact. High resistance can cause the LNB to switch permanently into the low voltage state. Very peculiar effects can occur if there poor connections amongst multiple cables to say an LNB and to a transmit BUC module as the go and return DC supplies may become mixed up and the wrong voltage applied across the various items. The electrical connections at the antennas between the LNB and the BUC chassis are often indeterminate and depend of screws in waveguide flanges etc. Earth loop currents may also be a problem - it is possible to find 50 Hz or 60 Hz mains currents on the outer conductors - so be careful. Such stray currents and induced RF fields from nearby transmitters and cell phones may interfere with the wanted signals inside the cables. The quality and smoothing of the the DC supplies used for the LNBs is important


How to test an LNB


Check with a current meter that it is drawing DC current from the power supply. The approx number of milliamps will be given by the manufacturer. Badly made or corroded F type connections are the most probable cause of faults. Remember that the centre pin of the F connector plug should stick out about 2mm, proud of the surrounding threaded ring.

Use a satellite finder power meter. If you point the LNB up at clear sky (outer space) then the noise temperature contribution from the surroundings will be negligible, so the meter reading will correspond to the noise temperature of the LNB, say 100K (K means degrees Kelvin, above the 0 K absolute zero temperature). If you then point the LNB at your hand or towards the ground, which is at a temperature of approx 300K then the noise power reading on the meter should go up, corresponding to approx 400K (100K +300K).

Note that LNBs may fail on one polarisation or on one frequency band and that the failure mode may only occur at certain temperatures.

[gmap]

Wednesday, 30 September 2009

Energy consumption - Geyser

Simulation of a Geyser Time Switch


The intention of this test was to try and understand the effects of switching the geyser off for a long period every day. The test was conducted on an old Sadia 30gal (136 litre), 3Kw geyser.  Hot water was used exclusively to shower twice a day, once in the morning and once in the evening.  No other hot water was used during the test period.  During the first two days the geyser was not switched off.  After that it was switched off at about midday and then switched on again at about 10:30pm at night for two days.  The temperature of the water did not seem to be noticeably lower during the evening shower on those days.

The graphs below represent the electricity used on each day:


You can clearly make out the "reheating spikes" where the thermostat switches the heating element on briefly to reheat the water after it has cooled. The longer duration heating events show when cold water entered the geyser to replace that used during a shower and required heating for up to a few hours.  It is assumed that the reheating spikes that occur shortly after the water was heated after a shower, are due to mixing of hot and cold water.  (We think that water near the element reaches operating temperature and thus the thermostat switches off the heating element.  But not all the water in the geyser has reached that temperature yet. So the thermostat has to switch on again when the hot water near the element mixes with cooler water elsewhere in the geyser).



Day1 - Normal Use Summary Figures:



Energy used heating cold water during/after showers       - 4.09kWh
Energy used by reheating spikes                                     - 1.65kWh
Number of reheating spikes                                            - 5
Average energy used per reheating spike                        - 0.33kWh



Day2 - Normal Use Summary Figures:



Energy used heating cold water during/after showers       - 4.68kWh
Energy used by reheating spikes                                     - 1.42kWh
Number of reheating spikes                                            - 5
Average energy used per reheating spike                        - 0.28kWh


Day1 - Simuated Time Switch Summary Figures:



Energy used heating cold water during/after showers       - 5.45kWh
Energy used by reheating spikes                                     - 1.02kWh
Number of reheating spikes                                            - 4
Average energy used per reheating spike                        - 0.26kWh


Day2 - Simuated Time Switch Summary Figures:



Energy used heating cold water during/after showers       - 4.84kWh
Energy used by reheating spikes                                     - 1.03kWh
Number of reheating spikes                                            - 3
Average energy used per reheating spike                        - 0.26kWh


Conclusions that can be drawn from this test:





  • For the geyser tested, 0.28kWh is used, on average, during each reheating spike, which occurred roughly every 4-6 hours.


  • 5 reheating spikes occur per day when the geyser is not switched off.


  • Switching off the gesyer from noon to approx. 10:30pm reduces the number of reheating spikes.


  • Because the showers weren't rigorously timed to be exactly the same each day, its not really possible to say for sure whether more energy is consumed on days when the geyser is switched off as opposed to days when it is not.


  • At best one can say the only energy saving one can expect from switching off the geyser for an extended period each day is a reduction in the average number of reheating spikes per day (reduced from 5 to 3.5 in this test).  Which is thus a maximum saving of 0.42kWh per day.  For a saving to occur, no additional energy should be used when the geyser is switched on again, other than that required to heat the cold water that replaced hot water used in any shower whilst the geyser was off.  However in this test no such saving was observed, the reverse in fact.


  • A more rigorous methodology will be required to conclusively establish whether any savings  can be achieved by switching off the geyser each day.


The summary figures for the test are:














Average energy used  per "normal day"5.92kWh
Average energy used per "timer day"6.17kWh

Wednesday, 1 July 2009

Grsync

Well after using Keep for some time and never been totally happy with it I decided to search for something else.

I started from the old trusted rsync and found a gui Grsync for it.

So far it works very well and fast for backup , I will investigate a automated startup next

Automated startup seem to be a problem, however a sync can be started from the command line with the correct "saved task"

I am doing all backups with Grsync now.

Monday, 22 June 2009

Symbolic Links in ProFTPd

A symbolic link (also referred to as a "symlink") is a file whose contents contain the name of the file to which the symbolic link points. For example:
  lrwxrwxrwx   1 root     root           11 Mar  2  2000 rmt -> /sbin/rmt

The file rmt contains the nine characters /sbin/rmt. The reason symbolic links fail when chroot(2) is used to change the position of the root (/)of the filesystem is that, once / is moved, the pointed-to file path changes. If, for example, if chroot(2) is used to change the filesystem root to /ftp, then the symlink above would be actually be pointing to /ftp/sbin/rmt. Chances that that link, if chroot(2) is used, now points to a path that does not exist. Symbolic links that point to nonexistent files are known as dangling symbolic links. Note that symbolic links to files underneath the new root, such as symlinks to a file in the same directory:
  > pwd
/var/ftp
> ls -l
-rw-r--r-- 1 root root 0 Jan 16 11:50 tmpfile
lrwxrwxrwx 1 root root 7 Jan 16 11:50 tmplink -> tmpfile

will be unaffected; only paths that point outside/above the new root will be affected.

so clearly this will not work in a ProFTPd default directory

The trick is to use re-mount the directory you want listed again

To have an exact duplicate of the /var/ftp/incoming directory available in /home/bob/incoming and /home/dave/incoming, use one of these commands:

  • Linux (as of the 2.4.0 kernel):
      mount --bind /var/ftp/incoming /home/bob/incoming
    mount --bind /var/ftp/incoming /home/dave/incoming

    or, alternatively:
      mount -o bind /var/ftp/incoming /home/bob/incoming
    mount -o bind /var/ftp/incoming /home/dave/incoming



On Kubuntu 9.x with kernel 2.6.28-11-generic the command was:
sudo mount --bind /media/disk/Sorted\ MP3/ /home/sharedftp/download/Music/

This mounted the Sorted MP3 directory under the FTPServer DefaultRoot directory.

In order to have these tricks persist, to survive a system reboot, the /etc/fstab file may need to have these mounts added

fstab

to mount a folder locally to another folder using --bind, ie. mount --bind /path1/ /path2/
/path1 /path2 bind defaults,bind 0 0

To mount a folder with spaces in fstab use "\040"

/media/disk/Sorted\040MP3/ /home/sharedftp/download/Music/ bind defaults,bind 0 0

Sunday, 7 June 2009

Satellite Positioning

Hardware Components

LNB

There is great post by ShaneW at

http://techies.co.za/phpBB2/viewtopic.php?t=5368&start=0&postdays=0&postorder=asc&highlight=






Hi guys. I was asked to explain to a few colleagues how an LNB works so I wrote up a bit of an explanation, thought it might help a few people on here aswell.
Please let me know if you have any comments/questions/changes.

LNB stands for Low Noise Block Down converter. Its main function is to convert a Block(Group) of High frequency signals to a lower frequency block, amplify it and give it to the decoder/receiver.
Satellites transmit and receive signals in the 3GHz – 5GHZ (Cband) and 10GHZ- 13GHz (KU Band) range, bear in mind that 5 GHZ=5 000 MHz = 5 000 000 KHz = 5 000 000 000 Hz (cycles per second). When signals are in this range, a coax cable is not a very conductor and you would lose most of your signal. This is where an LNB comes in, it converts the high frequency signal, coming from the satellite, to a lower more manageable frequency. These frequencies are in the 950 MHz to 2150 MHz range (L Band) and this is referred to as IF (intermediate frequency). Some High-end satellite earth stations use a LNA (Low Noise Amplifier) which doesn’t perform the Down-conversion, the high frequency signals are transported on a line, but it is expensive as you would need a waveguide(hollow tube with the correct dimensions for that frequency.)
Most satellite decoders are designed to receive L – Band signals, this is why we can use a satellite decoder to receive either C-Band or KU-Band, because they are both in the same frequency range (L-Band), after being down-converted by the LNB.
The First circuit in the LNB is a filter circuit, which removes all the unwanted signals, including any ‘out of band’ noise, it then passes the wanted frequencies to an amplifier which amplifies the small signal from the satellite. It then goes to the mixer circuit. How an LNB down-converts to a lower frequency is by the process of mixing. It uses a LO (Local oscillator), which is just a circuit that gives a specific frequency out, this signal has no Data or program content on it, it is just a ‘pure’ carrier. This LO signal, is then added to the signal that is coming from the satellite.
When you add 2 signals together you get a few results:
When we mix the LO FREQ with the SAT FREQ we would typically get the frequencies LO+SAT, LO-SAT, SAT-LO, LOxSAT, LO and SAT. Out of all of these signals that are produced we only want 1 of them, so the wanted freq would be filtered out and sent down the coax cable to our Decoder, sometimes we use the LO-SAT and sometimes the SAT-LO, just depending on what will get us to L-B and.
Here is an example:
Hope Channel on C-Band is transmitted at 4070 MHZ and the Local oscillator of a C-Band LNB is 5150 MHz, when these 2 signals are mixed inside the LNB, there are a few results but the one we want in the L-Band range ( LO – SAT ) 5150Mhz – 4070 MHz = 1080 MHz is filtered out and given out the decoder.
Most Decoders do this calculation for you so that you only have to insert the Satellite frequency into the decoder, provided that the LO frequency programmed into the decoder is correct. This does sometimes become a problem, in SA for instance we use KU-Band LNBs with a High LO of 10.7 GHz and most of the rest of the world uses 10.6 GHz, so most imported decoders are set to 10.6 GHz LO as standard. This is How it would work:
Say for instance we had a channel on 12 GHz, we would program this frequency into our decoder. So the decoder does its calculation 12 GHz-10.6 GHz(SAT-LO) = 1.4 GHz so it will look at 1.4 GHz ( 1400 MHz) for the signal. BUT our LNB is actually a South African type and its LO freq is 10.7 GHz. So what is happening in the LNB is 12 GHz – 10.7 GHz (SAT-LO) = 1.3 GHz. The signal is there, but it is not where the decoder assumes it to be and will give us a ‘no signal’ error. This is why it is important to give the correct LNB LO frequency details to your decoder.
A LNB also requires some power to turn it on and power its circuits. This is given by the decoder along the coax cable. So, going up to the dish we have the DC supply voltage and coming down we have the RF signal.
To save space on the satellite and allow more channels to be added, they use 2 polarities, Horizontal and Vertical. Circular polarization can also be used but I won’t attempt to explain this as I don’t fully understand how they do it yet. Polarization is basically the way the antenna is mounted, either parallel to the ground (Horizontal – Most TV antennas) or Perpendicular to the ground (Vertical – Like your car’s FM aerial). When a receive Aerial/Antenna is placed in the opposite polarity to the transmitter, a large amount of signal (If not all) is not received, so therefore they can put channels on horizontal and vertical on the satellite, without them interfering too much. This is what you are adjusting when you turn the ‘skew’ of your LNB.
Inside your LNB, you have 2 small aerials that sit inside, at 90 degrees to each other. The one will be Vertical and the other Horizontal, and they are initialized by either a 13V (Vertical) or 18/19V (Horizontal) DC supply coming from your decoder. Your decoder automatically switches between Vertical and Horizontal, depending on the polarization of the required channel.
On KU Band to get more channels onto the satellite, they expand the bandwidth and add more channels/transponders. They now introduce 2 LO’s into the LNB, A Low and a High, the high LO is initialized by a 22kHz tone on the cable. The Frequency of the Low Band would typically be 10.7 GHz – 11.7 GHz and the High Band 11.7 GHz – 12.85 GHz, produced by a LO of 9.75 GHz or 10.7 GHz respectively.
There are 4 states that an LNB could be in, provided that it as a dual band unit: Horizontal - High Band, Horizontal – Low Band, Vertical - High Band and Vertical - Low Band.


Dish Pointing

How to align a dish yourself:

Yes it is most definitely possible to do a self install, without any fancy test gear, just get the basics right!
You simply need a good sense of direction, a compass, a school protractor and a builders level, and some spanners that fits the nuts!. Of course you can always buy one of those caravaners kits because there is a simple pointing device in there, and then follow those directions! and a lot of patience is needed!

Make sure the pole mount that you screw to the wall is Vertical in all directions, as this make the pointing exercise much easier.
Mount the antenna on the pole

SKEW angle setting:

(a) Set the ELEVATION angle (up and down) in such a way as to make sure the LNB is Horizontal to the ground (the part point into the antenna).Temporarily lock the antenna in that position just so that it does not move on you.

(b) Now looking into the antenna, adjust the LNB skew angle, down from the Horizontal, rotation clockwise, to approximately the 16H00 position.

(c) Use a simple school protractor, set 0 degree to horizontal, and then turn the LNB clockwise to angle calculated.

(d) lock the LNB in place tight enough so that it does not move on you, and mark the position. If you get this right now then later skew angle adjustments may not be needed at all!.

SET the ELEVATION:

(a) to the calculated value, use the scale on the side of the antenna bracket, as this scale should already compensate for the offset angle.

(b) the pole mount is vertical, this angle will be almost perfectly correct

With the above two set you have now eliminated two of the 3 variables and only azimuth is now needed to be set!

SET the AZIMUTH:

(a) connect up the the cables, switch on the PVR, choose Mnet 101.

(b) IF this is a new PVR, then I suggest that you connect it up at home. let it scan and activate the card BEFORE you leave for your holiday home.

(c) Use the compass to find the basic direction, point the LNB arm of the antenna in that direction. Mark the position on the flange so that at least you know where that direction is.

(d) Now rotate the antenna SLOWLY in one direction until you get a signal, ( that is if you did not have a single immediately). Move until the antenna is obviously completely off position.

(e) if no signal move in opposite direction, till you get a signal, set on maximum ( should be more than 80%), and mark the position.

(f) Now deliberately move off this point in one direction till the signal drops to "zero", mark the position.

(g) Move in opposite direction till you go through maximum and drop off again to "zero", Mark that position.

(h) Set the azimuth half way between to two marks, and that should be close to the original maximum position.

(i) tighten bolts so that antenna will not move but beware of over tightening!

PEAK the elevation

(a) Now do the same as you did azimuth wise, vertically.

(b) MARK the position, loosen the clamps slightly, enough to allow antenna to just move, Move antenna UP till signal drops off to "zero", mark.

(c) Go DOWN till you get zero and mark. Divide by two and that should be where you set it originally!

(d) tighten elevation clamps

Peak the skew angle as previously described, tighten clamps enough to hold BUT beware of over tightening

[gmap]