I've decided to make my own mouse, because I like hardware and there is an artistic element to the project. IMGP1176.jpgIMGP1177.jpgIMGP1178.jpgIMGP1183.jpgIMGP1185.jpgIMGP1189.jpgIMGP1191.jpgIMGP1194.jpgIMGP1195.jpgIMGP1199.jpgIMGP1201.jpgIMGP1202.jpgIMGP1209.jpgIMGP1212.jpgIMGP1213.jpgIMGP1215.jpg

I now own my first Apple computer. After a week of debate with my inter demons, I pulled the trigger on a 24" imac 3.06Ghz core 2 duo.

The imac kind of goes against everything I've ever wanted. I haven't bought a put-together PC let alone an "all-in-one" machine in over 10 years. I've built dozens maybe even hundreds of machines at this point in my life. So... Why? Whenever I move it seems like I've collected more machines than the last time I moved. There is always (and almost overwhelming) collection of hardware which I have kept for the last few years.

I have less and less time to muck around with multiple machines and keep things for the sake of "oh thats going to be part of project z." I had to consolidate... I got rid of my Pentium II machine I was using as a pf firewall and local dns, an other machine that was a frankenpix, and two micro-itx machines which were once a car computer, and a mythtv set top box.

Although I never thought I would buy a all-in-once machine ever, like ever... I really enjoy it. If I want to accomplish a task I can write a bash script and run it with cron, but if I want to watch movies and need a nice UI.. I have it.

Software I think is good... (many suggestions via decavolt)

I hate the trash can... simple bash script to run in cron (runs on the 59th minute of every hour everyday:



59 * * * 1,2,3,4,5,6,7 /bin/rm -rf /Users/akonkol/.Trash/*

I've found there isn't a lot of good freeware for Mac, useful programs you would find in a Windows environment for free are usually about $30-$40 in the mac world. Because of my current environment and a bet at work.. I've started learning ruby on rails... I'm also making a mouse.

Summary: Bluetooth is now found in a variety of devices and enable the user to use wireless accessories.  The Bluetooth protocol allows a user to “discover” any device that is in proximity to your Bluetooth radio.  Why not see who is in proximity to you?  Why not have the presence of a device execute programs or alert you?

Andy Konkol – http://copyandwaste.com

Download:

Hardware:

  • Bluetooth radio (USB dongle)

  • SMA Female Jack

  • SMA male to N-male pigtail

  • 2.4 GHz antenna (with N-female connector)

Software:

Bluetooth and Hardware:
Bluetooth was designed for devices to communicate wirelessly over short distances.  However, with a very simple hardware modification you can extend the range of your Bluetooth radio with standard 2.4ghz antennas used in wireless networking (802.11 a/b/g).

Modifying Bluetooth dongles to accept external antennas is documented all over the Internet.  In principle it is very easy: find the antenna lead and solder on a connector/antenna.  I purchased a very cheap Bluetooth USB dongle on eBay and opened the casing.  After finding the antenna trace on the circuit board I soldered on a SMA Female connector to it.  After soldering the antenna jack in place I slipped a 3 inch chunk of heatshrink and heated it to cover the exposed circuit board.  Now I had a Bluetooth radio that accepts external antennas. Adding an antenna simply increases the range of your radio, allowing you to “see” devices from a farther distance.

To connect an external antenna to the dongle I needed to use a connector converter called a pigtail.  I used a SMA male to N-male pigtail.  I connected one end of the pigtail to my dongle and the other to an omni-directional 9dbi panel antenna that had an N-female connector.

 IMG_2070 IMG_2071

 

Software:
To take advantage of my newly modified hardware I needed to download the Coding4Fun Toolkit.  Included in the toolkit is an API for Bluetooth devices.  This API allows you to do a wide variety of things with your Bluetooth radio but I focused on two methods from the ServiceAndDeviceDiscovery library: DiscoverAllDevices and DiscoverDeviceByName.

DiscoverAllDevices allows you to “scan” the airwaves on the 2.4 GHz band and report back what devices your radio sees.

DiscoverDeviceByName allows you to scan for a particular device with a specified name and report back if it is present or not.

   1: private bool DevicePresent()
   2:         {
   3:             BluetoothDeviceServicesManager workerBTMgr = new BluetoothDeviceServicesManager();
   4:             Device workerDevice = workerBTMgr.DiscoverDeviceByName(_watchItem.DeviceName);
   5:  
   6:             if (workerDevice != null)
   7:             {
   8:                 return true;
   9:             }
  10:             else
  11:             {
  12:                 return false;
  13:             }
  14:  
  15:         }
  16:  
  17:         public void Run(String Operation)
  18:         {
  19:             switch (Operation)
  20:             {
  21:                 case "SingleDevice":
  22:                     if (DevicePresent())
  23:                     {
  24:                         _parentForm.Invoke(_parentForm.AddToDeviceSeenList, new object[] {_watchItem});
  25:                     }
  26:                     else
  27:                     {
  28:                         _parentForm.Invoke(_parentForm.RemoveFromDeviceSeenList, new object[] { _watchItem });
  29:                     }
  30:                     break;
  31:                 case "AllDevices":
  32:                     BluetoothDeviceServicesManager workerBTMgr = new BluetoothDeviceServicesManager();
  33:                     List<Device> Devices = workerBTMgr.DiscoverAllDevices();
  34:                     _parentForm.Invoke(_parentForm.ThreadUpdateDiscoverBox, new object[] { Devices });
  35:                     break;
  36:             }
  37:  
  38:         }

 

Both of these methods require that the device you are scanning for is in discoverable mode (which most manufacturers enable by default).  Using the two methods described above I was able to tell if a device is in proximity. And ultimately enabling me create alerts and execute programs based on what device is present.

To perform device discovery and not have my UI lag I had to create two worker threads.  One worker thread to discover all devices and display it under my devices listbox, and another to discover devices by name specified in the “watchlist.”  I am not an expert at multi-threaded programs but I managed to implement them without any major headaches.

 

User Interface:
Since the “Add to watchlist” and “Edit” buttons essentially do the same thing, I decided to overload a windows form.  I also wanted to keep track of the parent form and disable it when the WatchItemForm was shown.

The second overload allows me to fill in the form control's text based on the data that is already set for the WatchItem that has been selected (the Edit button). 

   1: public WatchItemForm(Form1 f, String DeviceName)
   2:         {
   3:             InitializeComponent();
   4:             this._parentForm = f;
   5:             lblDeviceName.Text = DeviceName;
   6:  
   7:         }
   8:  
   9:         public WatchItemForm(Form1 f, WatchItem item)
  10:         {
  11:             InitializeComponent();
  12:             this._parentForm = f;
  13:  
  14:             lblDeviceName.Text = item.DeviceName;
  15:             tbxAlertMessage.Text = item.AlertMessage;
  16:             tbxPicturePath.Text = item.ImagePath;
  17:             tbxProgramPath.Text = item.ProgramPath;
  18:             this._parentForm.Enabled = true;
  19:             
  20:         }

I wanted to have a pop up notify window similar to outlook and was able to find Robert Misiak's NotifyWindow. This is a very simple library which allows you to create pop up notify windows very easily. I edited NotifyWindow to include a “picturepath” variable as well as picturebox on the form. As you can see creating a NotifyWindow is quite easy:

   1: public void NotifyDeviceWindow(WatchItem x)
   2: {
   3:     NotifyWindow nw;
   4:     nw = new NotifyWindow();
   5:     //validate Alert Message
   6:     if (x.AlertMessage == null)
   7:     {
   8:         nw.Text = x.DeviceName;
   9:     }
  10:     else
  11:     {
  12:         nw.Text = x.AlertMessage;
  13:     }
  14:     //validate picture
  15:     if (x.ImagePath != null)
  16:     {
  17:         FileInfo imgfile = new FileInfo(x.ImagePath);
  18:         if (imgfile.Exists)
  19:         {
  20:             nw.PicturePath = x.ImagePath;
  21:         }
  22:         else
  23:         {
  24:             MessageBox.Show("Image does not exist");
  25:         }
  26:     }
  27:     nw.Notify();
  28:  
  29:     if (x.ProgramPath != null)
  30:     {
  31:         RunProcess(x.ProgramPath);
  32:     }
  33: }

Process Flow/Software Operation:

  1. User clicks the “Discover” button, a thread is spawned which enumerates all Bluetooth devices in proximity
  2. Thread finishes and updates the Devices listbox
  3. User selects a discovered device and clicks “Add to watchlist” A watch item form is spawned and asks you for an alert message, a picture path, and an executable path
  4. User clicks save , a WatchItem object is created and added to the watchList object
  5. A timer starts and every 10 seconds a thread is spawned to discover that device by name
  6. If the device is discovered, it is added to the “deviceSeenList” and a notify alert is sent and the executable is executed.
  7. If that device is still present after the next timer click, no notification is sent, If that device is not present it is removed from the “deviceSeenList”

Screenshots:

bb-main bb-watchitem bb-notify

I haven't bought a pre-made computer in more than 10 years.  I think I have finally gotten to a point where I don't want to muck around with commodity computer hardware.  It's time to buy a pre-made machine.  I use a wide variety of operating systems at home and at work.  The idea of a virtual desktop is very appealing to me.... a single machine where I can have windows, bsd, linux, and mac os x would be great.  I've done some research on "hackintosh" and to be honest... for the first time... it's a diy project I don't want to do. So I've pretty much decided that I need to buy a mac and a copy of parallels.  Now what kind of mac do I want? Macbook pro, Mac pro, or an iMac?

 

Mac pro is just way too much money  but upgrading would be easy.

iMac is a pretty closed device where replacing common things like hard disks could be a project... but the screen is so nice!

Macbook Pro would be pretty awesome but lacks some of the power I would like for virtualization.

 

It looks more and more that I should just get an iMac and stfu.  Maybe I'll get one...

imac_narrowweb__300x4422

I lost the source code I had originally for this sign.  Chris Gray left a comment about help and I ultimately ended up re-visiting code for the 4U2See.

 

Download CinderSerial

sign fixed with a hack...

The problem is that when I try to send a "file" to the sign,

c:\sequent.sys (on the sign) does nothget updated.  So you create a legit file with sigma editor, rename it without an extension.  Push the renamed file with sigma play.  This will update the sequent.sys

file on the sign.  Now run my program which sends a file named "A" to the sign and it should work.

 

Open Sigma Editor:

------------------

1) Click new file

2) enter in "working?"

3) Save to computer as "A.nmg"

4) Exit Sigma editor

5) Rename file to "A" (no extension)

Open Sigma Player:

------------------

6) Click on List Manage

7) Expand My Play List

8) Select all files in the right hand pane and delete them

9) Click the add button and find the "A" file in step 5

10) Send to sign

Compile my program (CinderSerial)

---------------------------------

1) Type in text you want to be displayed

2) Select a color

3) (display mode isnt implemented yet)

4) Click submit

Chances are that your boss, director, or CTO is using bluetooth on their phone.  Since they are using bluetooth you can scan the 2.4ghz radio band and look for devices that are within the proximity of your bluetooth dongle(radio).  This application scans that band for devices that are within your proximity and allows you to receive a pop-up message from the system tray when a known  device is in the area.  More importantly you can configure applications to be run, like..... "firefox www.yourcompanieswebsite.com"  when  say... your boss's bluetooth enabled phone is in the proximity.

You do not have to be paired with any bluetooth device to be able to discover it with the Coding 4 Fun bluetooth API.  Although using this method of discovery is not guaranteed I have found it to work in a variety of phones.  To increase the range of my radio I modified my dongle to accept an external antenna.  With this hardware I can get a range of about 50 feet tested.

Hardware:

  • Bluetooth Dongle - $1.99
  • SMA Female connector - Free (had one)
  • SMA to N-Male pigtail - $6.99
  • 9dbi Panel Antenna - Free (had one)

IMG_2067 IMG_2068 IMG_2071 IMG_2073

Software:

All you have to do is press "Discover" when the bluetooth device is in proximity and Add it to the Watchlist.  You may specify an alert message, a picture to display, and/or a program to run.  A worker thread is spawned when the Discover button is pressed:

   1: private void btnDiscover_Click(object sender, EventArgs e)
   2: {
   3:     btnDiscover.Text = "scanning";
   4:     btnDiscover.Enabled = false;
   5:  
   6:     m_EventStopThread.Reset();
   7:     m_EventThreadStopped.Reset();
   8:  
   9:     // create worker thread instance for discovering all devices
  10:     m_WorkerThread2 = new Thread(new ThreadStart(this.DiscoverWorkerThread));
  11:     m_WorkerThread2.Name = "Discovering Worker Thread";    // looks nice in Output window
  12:     m_WorkerThread2.Start();
  13:  
  14:     lbxDevices.Items.Clear();
  15:  
  16: }

 

On Form load, a timer is enabled for 10 seconds, when that timer "ticks" a DiscoverByName is performed by a worker thread:

   1: private void tmrMain_Tick(object sender, EventArgs e)
   2:        {
   3:            //read xml config >> watchList
   4:            //timer went off, foreach watchitem spawn worker thread to poll device
   5:            foreach(WatchItem tmp in watchList.WatchItems)
   6:            {
   7:                // reset events
   8:                m_EventStopThread.Reset();
   9:                m_EventThreadStopped.Reset();
  10:  
  11:                // create worker thread instance
  12:                m_WorkerThread = new Thread(new ParameterizedThreadStart(this.WorkerThreadFunction));
  13:                m_WorkerThread.Name = "Worker Thread Discover By Name";
  14:                m_WorkerThread.Start(tmp);
  15:  
  16:            }
  17:        }

From the "Worker" class, which actually does the polling and callback to the parent form delegate:

   1: private bool DevicePresent()
   2: {
   3:     BluetoothDeviceServicesManager workerBTMgr = new BluetoothDeviceServicesManager();
   4:     Device workerDevice = workerBTMgr.DiscoverDeviceByName(m_WatchItem.DeviceName);
   5:  
   6:     if (workerDevice != null)
   7:     {
   8:         return true;
   9:     }
  10:     else
  11:     {
  12:         return false;
  13:     }
  14:  
  15: }
  16:  
  17: public void Run()
  18: {
  19:     if (DevicePresent())
  20:     {
  21:         try
  22:         {
  23:             m_form.Invoke(m_form.m_NotifyDevicePresent, new object[] { m_WatchItem });
  24:         }
  25:         catch (Exception ex)
  26:         {
  27:             MessageBox.Show(ex.Message.ToString());
  28:             
  29:         }
  30:     }
  31:  
  32: }

bb-main  bb-watchitem

Once you have added a device to the watchlist a worker thread is spawned and tries to discover that device every 15 seconds or so.

 

bb-notify

Some code I used:

Download BlueBoss v1.0

It was time to replace my mid-tower Pentium II soho router running OpenBSD with something smaller.  There has been quite a bit of interest in the community about single board computers, such as soekris and alix  and I decided to dive right in.  Single board computers are just that, everything you need for a basic bare bones machine.  Due to cost I chose an ALIX 2C.3 board and a silver case to go with it.

alix2b3 case1c2u

Hardware:

Item Price
ALIX 2C.3 $137.00
15v/1.2A AC-DC Power Adapter $9.95
Enclosure 3 LAN for Alix.2 $12.95
1GB CF card $10
Targus TG-CRD25 Universal 32-in-1 Memory Card Reader $4.99
Total: $174.89

 

Software:

I chose OpenBSD as the operating system because of it's simplicity, pf, and I use it everyday.  There is a project by nmedia.net that focuses on building OpenBSD images for single board computers called flashdist but I decided to take a different approach.

 

Installation: Putting OpenBSD on Compact Flash

  1. Connect usb cf reader with memory card inserted to any i386 machine
  2. Insert OpenBSD CD and boot from it
  3. Upon boot my cf card is recognized as /dev/sd0
  4. Follow basic install guide which can be found here
  5. Once you get to the part where you select your disk supply the path to your cf.
  6. Available disks are: sd0.
    Which one is the root disk? (or done) [sd0] <enter>
    Do you want to use *all* of sd0 for OpenBSD? [no] yes
  7. Since the disk is so small I decided just to go ahead and make a single partition which mounts "/"
  8. Configure your networking etc... and select what packages you need (with size concerns in mind)
  9. After the packages are installed go through the rest of the setup criteria and halt the fresh install
  10. Remove the CF card and insert it into your ALIX board and boot.
  11. Your ALIX board should be addressed and running sshd, login and config!

I added wget, pftop, and ntop through pkg_add, configured named for local dns, and configured dhcpd to provide addresses for all hosts on my network.

 

This device is awesome....tiny...silent...low power and does everything I need.

For Maker Faire I built a LED display using 10 BetaBrite Prism signs.  Everything I used was store bought and nothing custom.  The general idea was to capture motion video using a webcam and display it on this matrix of LED signs.  However, after receiving the hardware this became impossible noting the 3-4 second delay in the time from which transmission to the sign starts, and when the image is displayed.  I also wanted to take advantage of the usb port on each sign but ran into problems connecting more than one BetaBrite Prism via usb at a time.

COMPROMISE--

  • Since the signs where too slow I had to change the direction of this project into a "photo booth" of sorts meaning that I would take timed snapshots via a webcam instead of full motion video.
  • Connecting more than one sign using USB didn't work so I was stuck buying 10 USB->Serial adaptors
  • The signs support up to 64 colors, however trying to modify the BetaBrite class to handle these colors fell through.

Hardware:

pcms882224035477rt 181796bs  10033386 

  • 10 BetaBrite Prism signs
  • 10 Serial to USB converters
  • 3 USB SQUID
  • 1 USB Xbox Webcam
  • Plywood
  • Drywall Screws

Software:

  • BetaBrite API written by Jeff Atwood, ported by Clint Rutkas
  • DirectShow lib (emphasis on DxSnap application)
  • Code to splice web cam images and send to sign

You can download my source here.

How it works:

A picture (bitmap) is taken by the attached webcam using DirectShowLib, that bitmap is "spliced" meaning divided into 7 pixel by 80 pixel pieces (the LED layout on the sign).  Each of those pictures is analyzed by the BetaBrite API and the pixels are checked one by one and associate a color value to that pixel to be sent to the sign.  Once pixel color information is determined, that information is sent to the correct BetaBrite sign over a RS232 connection.

...hey! that's simple!... that's the point!

 

Some Details:

  • In order to aide the "pixel correlation" step I used the webcam property page to adjust the settings so that the webcam was set for high contrast and high saturation.
  • To keep the sending info the sign automated I connected each serial to usb adaptor one at a time making sure they showed up in sequence (i.e. COM6, COM7, COM8) and positioned the signs accordingly on the plywood stand.
  • To compensate for the bezels on the signs I simply "cut out" those pixels when splicing the image

First Picture: Rob Taking his picture (the screen has not updated yet)

Second Pictures: Rob's picture on the LED screen

n4713141_33421112_5179_2 n4713141_33421113_5499_2

I was asked to join the Microsoft Coding4Fun team this year at Maker Faire.  The project I came up with was multiplexing several stock store bought signs and display full motion video from a webcam on them... Unfortunately it's almost impossible to do full motion with stock parts, so it evolved into a "LED photobooth."

The signs are BetaBrite Prisms, the software is written in c#.

 

The software is driven by many c# examples derived from the web:

 

n4713141_33421108_3895 n4713141_33421107_3577 n4713141_33421109_4218 n4713141_33421110_4541 n4713141_33421111_4857 n4713141_33421112_5179 n4713141_33421113_5499 n4713141_33421130_1154

 

It was two very long days.

When I was in junior high I inherited about 8 years of diy electronics magazine.  I immediately dove in and built a darkroom to build printed circuit boards and created a whole lab of "stuff."  I made a ton of things then lost interest at the beginning of college and abandoned all my gear.  A couple of months ago after writing code for 4U2SEE LED signs, a co-worker of mine gave me a "wiring" (www.wiring.co.uk) board and sparked my interest in electronics again.  So I've bought a bunch of stuff.

  1. Digital temp soldering iron
  2. Kanda STK 200 avr programmer
  3. Bread/perf boards
  4. LEDs, LED Matrices
  5. Resistor kit
  6. Capacitor kit
  7. "Helping hands"
  8. A few LCD screens
  9. and a whole bunch of other stuff

My career now focusing on computer/network security I've decided to build some keyloggers.  I really have no idea what I'm doing but I'll figure it out.

I've taken on a new project for Maker Faire this year, which involves a lot of LED signs and webcams.  Let me just say the vendor that I'm dealing with made promises they couldn't keep.

So I plan on posting a bunch of micro controller projects and security related projects in the months to come.