Posts tagged ‘Electronics’

Arduino ps2 mouse

arduino mouse and anoying encoder
I have been tinkering a bit with the arduino the last couple of days. Mostly small experiments with some of the junk had around, after some frustrations with a circuit for a rotary encoder, i “gave up” and tried hooking up a ps2 mouse. There are a nice tutorial at the arduino playground. It seemed complicated to interface with a mouse this way. But it proved to be so much easier than trying to build a circuit. The software coding is so much easier than the electrical circuits.

It was a matter of connecting 4 wires and uploading the code to get it running. But then i found out that there wasn’t support for the mouse-wheel, so i googled the datasheet for the IC, and started hacking. I ended up getting the mousewheel to function and getting output for the buttons. Along the way I refactored some of code, in order to better understand what was happening.

I still haven’t figured out what I should use the mouse for, but it was a fun hack.

Here is the sourcecode, if you want to try something with it : ps2mouse for arduino

I tried to make nice comments so it should be very straightforward to work with. As mentioned a haven’t made most of the code, just some additions and refactoring.

The mouse and the annoying encoder i couldn’t build a circuit for. It can be attached to a motor where there are a slotted wheel.

(21 nov updated code)

Arduino ambient dashboard

Yesterday I finally got the Arduino, I ordered from Segor Electronics. Which by the way had a good service and packed it securely.

I had a plan to create a Ambient dashboard, that is to have some analog meters that would convey some digital information. In an non obtrusive way, i think it has a very fine name, peripheral awareness.

I found it easy to code the arduino and to work with, so far that is. Using ubuntu I for some peculiar reason had to uninstall braille support, as it automatically recognizes it a braille device.

In order to communicate with the arduino it uses a usb serial connection, that is its connected to the usb port, but it behaves like a serialport. The simple way to send data to the arduino is setting up stty and then you can do stuff from bash like echo “data” >/dev/ttyUSB0 and voila it receives the data.

dashboard1 dashboard2

Here is the prototype setup in all is lousy light condition for mobile cam glory.

There are 5 different meters and they all use PWM, without any capicitors or filters, and it just works, most of the time. Its coded so that when its send a string like 23#34#23#34#34 terminated by a newline, it adjust the displays to the values.(0-254).

Now the next part is to make some kind of script to read relevant information and pass it along to the dashboard, since i use linux some information is available trough acpi as virtual files. But the hunt for easy accessible and relevant data has started, i would really like to display bandwidth usage but so far i haven’t had any luck figuring out where it resides.