Archive

Archive for the ‘Ubuntu’ Category

How a 4-pin tactile switch works

February 22nd, 2013 No comments

Here it is an application example of a type of a 4-pin tactile switch

4-Pin Tactile Switch

Each pin is already in contact with in the pin in front of it. When you press the button, all pins are connected together.

Here the switch disassembled

4-pin tactile switch disassembled

The rounded metal plate, in the bottom of the picture, is placed upon the the three metal parts, that you see in the switch base in the left of the picture.

This plate is a little concave, so when the button is unpressed, it only connects the metal parts on the sides

When you press the button, you are going to press in the center of the rounded metal plate and it will connect all the 3 metal parts.

This way, the circuit is closed and all pins can connect together.

But how it is possibile?

Here a schema I drew

4pin_tactile_switch_schema

Red and blue lines show how pins and metal parts are connected together internally. So when the rounded metal plate touches all the three metal parts, it closes the circuit.

 

Enjoy :)

Categories: Ubuntu Tags:

How-To: install and configure SNMP v3 on CentOS 6.2

February 20th, 2012 No comments

Install SNMP

[cce_bash]yum install net-snmp-utils net-snmp-libs[/cce]

Create a new user using the net-snmp-create-v3-user command

[cce_bash]Usage:
net-snmp-create-v3-user [-ro] [-A authpass] [-X privpass]
[-a MD5|SHA] [-x DES|AES] [username][/cce]

[cce_bash][root@centos-mail ~]# net-snmp-create-v3-user -ro -A auth_password -X privacy_password -a SHA -x AES cactiuser
adding the following line to /var/lib/net-snmp/snmpd.conf:
   createUser cactiuser SHA "auth_password" AES privacy_password
adding the following line to /etc/snmp/snmpd.conf:
   rouser cactiuser[/cce]

Test it with

[cce_bash]snmpwalk -v 3 -u cactiuser -a SHA -A "auth_password" -l authPriv -x AES -X "privacy_password" localhost[/cce]

Change auth_password and privacy_password with your passwords.

Enjoy :)

 

 

SOURCE: SNMP v3 Setup Guide by Digital Servitude

Categories: Ubuntu Tags:

How-To: set master monitor on a dual head configuration on Ubuntu 11.04

September 5th, 2011 No comments

OS: Ubuntu 11.04 (Natty Narwhal)
Video Card: Intel Integrated Graphic Card
Video output: 1 DVI, 1 VGA

The system “Monitors” application let you set the disposition of the two monitors, which is left and which is right, but it doesn’t let you decide which is the master (or 0 and 1).
By default, the system set the VGA monitor as master but I want it to be the slave and configure the DVI monitor to be the primary.

Run xrandr to view how monitors are named and what are used:

[cce_bash]massimo@bebop:~$ xrandr
Screen 0: minimum 320 x 200, current 2560 x 1024, maximum 8192 x 8192
VGA1 connected 1280x1024+1280+0 (normal left inverted right x axis y axis) 338mm x 270mm
   1280x1024      60.0*+   75.0 
   1152x864       75.0 
   1024x768       75.1     70.1     60.0 
   832x624        74.6 
   800x600        72.2     75.0     60.3     56.2 
   640x480        72.8     75.0     66.7     60.0 
   720x400        70.1 
HDMI1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 337mm x 270mm
   1280x1024      60.0*+   75.0 
   1152x864       75.0 
   1024x768       75.1     70.1     60.0 
   832x624        74.6 
   800x600        72.2     75.0     60.3     56.2 
   640x480        72.8     75.0     66.7     60.0 
   720x400        70.1 
DP1 disconnected (normal left inverted right x axis y axis)[/cce]

In my case, the DVI connection is identified as HDMI1.
Now shut off the VGA monitor

[cce_bash]xrandr --output VGA1 --off[/cce]

Shut off the DVI

[cce_bash]xrandr --output HDMI1 --off[/cce]

WARNING: doing this will disable both of your monitors!
Keep the terminal on top and write next command blindly.

Set the HDMI1 interface as primary

[cce_bash]xrandr --output HDMI1 --auto --primary[/cce]

Enable the secondary and put it to the right of the primary

[cce_bash]xrandr --output VGA1 --auto --right-of HDMI1[/cce]

Enjoy :)

 

 

SOURCE: ubuntuforums.org – [ubuntu] Changing master monitor in dual set-up

Categories: Ubuntu Tags:

Change vMA keyboard layout

June 4th, 2011 No comments

Edit /etc/sysconfig/keyboard

[cce_bash]sudo vi /etc/sysconfig/keyboard[/cce]

replace KEYTABLE to your language set (in my case italian)

[cce_bash]KEYTABLE="it"[/cce]

Reboot vMA.

 

Enjoy :)

Categories: Ubuntu Tags:

How-To: install NUT on Ubuntu 10.10 Maverick Meerkat

March 28th, 2011 15 comments

In this How-to I will explain how to install and configure Network UPS Tools on Ubuntu 10.10 Maverick Meerkat.
I will configure it with my APC BackUPS RS 800.
Install the package

[cce_bash]sudo apt-get install nut[/cce]

Now we need to find out what driver we need to use.
Check it out at the Hardware Compatibility List.
In my case the driver is usbhid-ups.
Edit /etc/nut/ups.conf and add the following

[cce_bash][apc]
driver = usbhid-ups
port = auto[/cce]

Start the driver

[cce_bash]sudo upsdrvctl start[/cce]

but you can get this error

[cce_bash]Network UPS Tools – UPS driver controller 2.4.3
Network UPS Tools – Generic HID driver 0.34 (2.4.3)
USB communication driver 0.31
Can’t chdir to /var/run/nut: No such file or directory
Driver failed to start (exit status=1)[/cce]

Do the following to fix the problem

[cce_bash]sudo mkdir /var/run/nut
sudo chown root:nut /var/run/nut
sudo chmod 770 /var/run/nut[/cce]
sudo mkdir /var/run/nut
chown root:nut /var/run/nut
chmod 770 /var/run/nut

Try again with the command

[cce_bash]sudo upsdrvctl start[/cce]
sudo mkdir /var/run/nut
chown root:nut /var/run/nut
chmod 770 /var/run/nut
Network UPS Tools – UPS driver controller 2.4.3
Network UPS Tools – Generic HID driver 0.34 (2.4.3)
USB communication driver 0.31
Can’t chdir to /var/run/nut: No such file or directory
Driver failed to start (exit status=1)

if it works, you should have an output like this

[cce_bash]Network UPS Tools - UPS driver controller 2.4.3
Network UPS Tools - Generic HID driver 0.34 (2.4.3)
USB communication driver 0.31
Using subdriver: APC HID 0.95[/cce]

Now edit /etc/nut/upsd.conf and add the following lines

[cce_bash]LISTEN 127.0.0.1 3493
LISTEN ::1 3493[/cce]

This way, upsd will only listen to localhost port 3493/tcp.
Start the network data server

[cce_bash]sudo upsd

Network UPS Tools upsd 2.4.3
listening on ::1 port 3493
listening on 127.0.0.1 port 3493
Connected to UPS [apc]: usbhid-ups-apc[/cce]

Check the UPS status

[cce_bash]sudo upsc apc@localhost ups.status

OL[/cce]

OL means your system is running on line power.
Look at all of the status data which is being monitored

[cce_bash]sudo upsc apc@localhost

battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2001/09/25
battery.mfr.date: 2007/03/14
battery.runtime: 641
battery.runtime.low: 120
battery.temperature: 29.2
battery.type: PbAc
battery.voltage: 27.4
battery.voltage.nominal: 24.0
device.mfr: APC
device.model: Back-UPS BR  800
device.serial: QB0711130221
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.4.3
driver.version.data: APC HID 0.95
driver.version.internal: 0.34
input.sensitivity: high
input.transfer.reason: input voltage out of range
input.voltage: 232.0
input.voltage.nominal: 230
output.voltage: 230.0
output.voltage.nominal: 230.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 9.o2 .I
ups.firmware.aux: o2
ups.load: 20.0
ups.mfr: APC
ups.mfr.date: 2007/03/14
ups.model: Back-UPS BR  800
ups.productid: 0002
ups.serial: QB0711130221
ups.status: OL
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d[/cce]

Now edit /etc/nut/upsd.users and add the following lines

[cce_bash][monuser]
        password = mypass
        actions = SET
        instcmds = ALL
        upsmon master
        # or upsmon slave[/cce]

change the password field with a real password.
Reload upsd

[cce_bash]upsd -c reload[/cce]

Edit /etc/nut/upsmon.conf, create a monitor directive for upsmon

[cce_bash]MONITOR apc@localhost 1 local_mon mypass master[/cce]

Edit /etc/nut/nut.conf and change the mode to Standalone

[cce_bash]MODE=standalone[/cce]

Now you can start NUT with

[cce_bash]sudo service nut start[/cce]
echo “$*” | mailx -s “UPS Notice” test@example.com

 

 

If you want to enable e-mail notifications for UPS events, as suggested by Witwolf, edit again /etc/nut/upsmon.conf and add

[cce_bash]NOTIFYCMD /usr/local/bin/nut-notify.sh

NOTIFYFLAG ONLINE   SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT   SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT  SYSLOG+WALL+EXEC
# NOTIFYFLAG FSD     SYSLOG+WALL
# NOTIFYFLAG COMMOK  SYSLOG+WALL
# NOTIFYFLAG COMMBAD SYSLOG+WALL
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC
NOTIFYFLAG NOCOMM   SYSLOG+WALL+EXEC
NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC[/cce]

Create the script /usr/local/bin/nut-notify.sh and paste the following

[cce_bash]#!/bin/sh
echo "$@" | mail -s "NUT Notice" test@example.com[/cce]

make it executable

[cce_bash]sudo chmod +x /usr/local/bin/nut-notify.sh[/cce]

 

 

Enjoy :)

 

 

SOURCES:
Network UPS Tools: User Manual – Configuration notes
Witwolf: My new APC Back-UPS Pro 900 arrived!

Categories: Ubuntu Tags: