Syslog Watcher from EZ5 Systems




Syslog Watcher from EZ5 Systems is a dedicated syslog server for windows, integrating log data from multiple network devices into a single, easily manageable and accessible computer interface. Collecting and analyzing syslogs events is essential for security auditing and maintaining network stability of any size network infrastructure. 

Nearly every IP device connected to a network logs system events locally or is capable of sending out syslog event messages. These include the new breed IoT devices that operated as special purpose applications or platforms (i.e. sensors). Syslog Watcher advanced networking capabilities supports IPv4 and IPv6 interfaces and the syslog protocol over UPD and TCP for congestion control and reliability.

However, not all syslog servers can scale performance under the tsunami of messages created by all these network devices. A quality syslog server has to work fast  to do more than just collect and write  messages to a file. Syslog Watcher uses a highly efficient multi-threaded architecture optimized for  performance, so the collection of new records isn’t held up by the completion of processing. The syslog storage is designed to work under heavy loads and can process thousands of syslog messages per second. 

The control dashboard provides comprehensive filtering capabilities using standardized regexps in the message body to unify filtering rules for all operations.  The smart parser feature determines the source type and correctly handles deviations from the standard. Email alert rules trigger emails in response to incoming syslog event conditions to alert the designated administrator.

Syslog Watcher supports exporting collected syslog messages to any text file type format like CSV, XML, JSON, etc. Moreover, syslog server administrators are not limited file exports alone. Syslog Watcher can export collected data to any SQL, NoSQL, file-based database via industry standard  ODBC connectors.
For more information about Syslog Watcher and EZ5 Systems other products please visit https://syslogwatcher.com 

SDR SCANNER


SDR Scanner How-TO
by Harrison Sand

Overview

In this guide I will explain how to build an inexpensive SDR that can be used to receive police, fire, taxi, and other digital radio transmissions. I will do my best to explain the steps in detail, and provide further resources to help along the way.

I have to give a lot of credit to the creator of the following guide: http://public-xrp.s3.amazonaws.com/docs/sdrsharptrunk.htm This how to is based largely from that, and other sites listed in the Resources section.

Demo Video



HARDWARE


Download and extract Zadig (you will need a program like WinRAR or 7-Zip). Take note if using Windows XP you will need to download the XP version. Connect the receiver to your computer and ignore/cancel any attempts Windows tries to make to automatically install drivers. In Zadig select “Bulk-In, Interface (Interface 0)”. You may need to go under options and list all devices. Select WinUSB as the driver to install and press Install/Replace Driver.













Next to Driver it should now say WinUSB and the version number. I don’t believe it is required, but if you like you can do the same for Interface 1.

Install SDRSharp

Download the modified SDRSharp package and extract it. Inside the folder is a file called rtlsdr.dll that needs to be replaced. We will get the updated version from inside RelWithDebInfo.zip. Use the file in the /x32 folder. Also note RelWithDebInfo.zip contains executables that can be helpful in troubleshooting should you encounter any driver issues.

If you like you can test to make sure your radio is working properly. Open SDRSharp, set the front end to “RTL-SDR / USB” select WFM and type in a known FM radio station to the center/frequency boxes and press play. For example, if you would like to tune to 97.9 type in 97900000. You can drag the red line to align with the stream in the waterfall.




Configuring Digital Speech Decoder (DSD)
Virtual Audio Cable

Install Virtual Audio Cable as it is required to route the audio out from SDRSharp into DSD. Using the trial version will work reasonably well however since it periodically adds a voice over the stream you may or may not have some decoding errors. A new Virtual Audio Cable device should now appear under your playback and recording devices.
Windows Sound System Configuration

DSD uses the Windows default recording device as an input. Ensure Virtual Audio Cable Line 1 is set as the default recording audio device in the windows sound properties.





Install Cygwin

Install Cygwin using all of the default settings. Once installed browse to C:/cygwin/bin and copy the cygwin1.dll file to the same folder the DSD program will be in.
Download DSD

Download the Windows Binary and place it in the same folder as the cygwin1.dll file.
Configuring UniTrunker

A trunked radio system is simply a system of radios in which the frequencies used are dynamically managed by a central controller. Most police and fire radios use a trunked radio system. Unitrunker decodes the control channel, and tells the receiver which frequency to tune to. After downloading and installing, run UniTrunker. Choose “First Time Installation” and Continue.



Two receivers must be configured in UniTrunker, a ‘Signal’ receiver used to receive the control channel signal, and a ‘Control’ receiver used to receive the voice channel transmissions. This can be a little confusing as the signal that the ‘Signal’ receiver is receiving is typically called a ‘Control Channel’.

Signal Receiver

To configure the signal receiver, press the plus button on the top and select “Signal”.

The only hardware required besides a computer is going to be a SDR receiver. The bulk of these radios are just USB TV tuners, rebranded and sold as SDR receivers. Many are available on Amazon and eBay. A quick google search should turn up some more as well.

In this guide I will be using a Newsky TV28T v2 with a RTL2832U & R820T tuner.











SOFTWARE


Please use the normal download link if possible to receive the latest software packages. Secondary links are provided for redundancy.

SDRSharp

Software defined radio application. Allows for tuning and receiving of audio from receiver.
A modified version will be needed that is capable of connecting to UniTrunker.

Website: http://sdrsharp.com/
Download: https://public-xrp.s3.amazonaws.com/Release-latest.zip
Download (secondary): https://googledrive.com/host/0BwBTquKxCLOBc3hFLVoxM0o2LW8/Release-latest.zip

rtlsdr.dll - Updated file for SDRSharp

Download: http://sdr.osmocom.org/trac/attachment/wiki/rtl-sdr/RelWithDebInfo.zip
Download (secondary): https://googledrive.com/host/0BwBTquKxCLOBc3hFLVoxM0o2LW8/RelWithDebInfo.zip


Zadig - Version used: 2.0.1.160

Allows for receiver driver installation.

Website: http://rtlsdr.org/softwarewindows
Download: http://sourceforge.net/projects/libwdi/files/zadig/
Download (secondary): https://googledrive.com/host/0BwBTquKxCLOBc3hFLVoxM0o2LW8/zadig_v2.0.1.160.7z


UniTrunker - Version used: 1.0.26.14 preview

Provides decoding support for trunking control channels and issuance of tuning commands.

Website: http://unitrunker.com/
Download: http://unitrunker.com/download/
Download (secondary): https://googledrive.com/host/0BwBTquKxCLOBc3hFLVoxM0o2LW8/UniTrunker-1.0.26.14.msi


Virtual Audio Cable - Version used: 4.10

Provides audio routing between components. Trial available, purchase for $25.

Website: http://software.muzychenko.net/eng/vac.htm
Download: http://software.muzychenko.net/eng/vac.htm#download
Trial Download (secondary): https://googledrive.com/host/0BwBTquKxCLOBc3hFLVoxM0o2LW8/vac412.zip


Digital Speech Decoder (DSD) - Version used: 1.6.0 Beta

Provides digital voice decoding support.

Website: http://wiki.radioreference.com/index.php/Digital_Speech_Decoder_(software_package)
Download: http://wiki.radioreference.com/index.php/Digital_Speech_Decoder_(software_package)#Downloads
Download (secondary): https://googledrive.com/host/0BwBTquKxCLOBc3hFLVoxM0o2LW8/dsd160.exe


Cygwin -Linux support for Windows. Required by DSD.

Website: http://www.cygwin.com/
Download: http://cygwin.com/setup.exe
Download: (secondary): https://googledrive.com/host/0BwBTquKxCLOBc3hFLVoxM0o2LW8/setup.exe


Microsoft Visual C++ 2010 Runtime

Required by remote.dll

Download: http://www.microsoft.com/en-us/download/details.aspx?id=5555
Download (secondary): https://googledrive.com/host/0BwBTquKxCLOBc3



Resources

Most of the information in this tutorial is stuff pulled together from the web. Here are some great places to get more information.

SDRSharp Quick Start Guide: http://www.atouk.com/SDRSharpQuickStart.html
Digital Speech Decoder (DSD) Guide: http://ukradioscanning.com/viewtopic.php?f=4&t=312
Unitrunker Configuration Guide: http://public-xrp.s3.amazonaws.com/docs/sdrsharptrunk.htm <-- See for two receiver configuration
Massive Radio Frequency Database: http://www.radioreference.com/apps/db/


Configuring the SDR Receiver

Install Drivers

































For the Audio Port setting, select the Virtual Audio Cable created earlier. Set the Sample Rate to 48000, and check all of the decoding protocols.

Control Receiver
To configure the Control receiver, press the plus again and select “Control”.





















Set the Model to “Debug”, and select all three control protocols: P25, ProVoice, and VSELP.
Finally, in the main UniTrunker options screen, click the Enable checkbox in the Listen section:






















There should now be two receivers listed under the Receivers tab. One control and one signal. Select each and press the play button.















Finding a Control Channel

Before starting SDRSharp, open the ‘sdrsharp.exe.config’ file and ensure this line is set as follows:

<add key="minOutputSampleRate" value="48000" />

Open SDRSharp and configure with the following settings:

  • set the radio to NFM
  • Press the “Front end” button, disable RTL AGC, and enable Tuner AGC
  • set the Filter bandwidth to 12500
  • ensure Squelch, Snap to grid, Correct IQ, and Swap I & Q are all disabled
  • under the Audio dropdown ensure Filter Audio is unchecked, and the audio output is the Virtual Audio Cable.
Press Play.

Now we need to locate a control channel. This part can be a bit tricky, but after some practice it gets easier. You can start by looking for channels in the 850-900MHz range, but another good place to start is in the radioreference.com frequency database.

Browse to your area and find the section labeled “Trunked Radio Systems”. Browse through the systems and find one that has a good amount of information. See the example below.





We are interested in the control channels, shown in red and blue.

Test each control channel until you find one you can receive. For example, if I want to test 856.21250a then I need to enter 856212500 into the Frequency and Center boxes in SDRSharp. (Note the extra 0, and no decimal point)



















Control channels will be a continuous stream in the waterfall window, unlike voice transmissions which are intermittent.

If you cannot find a signal, try other trunked systems listed in your area, listed in surrounding areas, or by manually browsing the spectrum.

If you find that a control stream is to the near right or near left of the red line after typing in a known frequency, manually move the line to be in the center of the stream. It may be helpful to zoom in. This problem will be dealt with under the calibration section.

After about 10-15 seconds of being tuned to a control channel, a new window should pop up in UniTrunker.



























After a few seconds to a few minutes several frequencies should populate and channel activity will start scrolling by. If you see a red “Frequency Needed” and 0.00000, wait a few more minutes to see if it goes away. If not, click on the small calculator icon at the top and then standard.

Calibrating the Tuner

Because this tuner will be tuned programmatically, it is essential that it is correctly calibrated.

Enter the known control frequency (either from radioreference, or the red frequency listed in UniTrunker) in the center and frequency boxes.




















You may see that red line not aligned with the channel. Open the “Front End” dialog box and adjust the Frequency correction value until the red line is centered onto the channel.
Lock UniTrunker to the Control Channel

After you have found a control channel and calibrated the tuner you will need to lock UniTrunker down to only receive that control channel. Everything would technically work without this step, but it helps UniTrunker find the control channel faster as it switches between the control and signal.

Double click the Signal line under the Receivers tab and change the “Lock Mode” to Dedicated.





Double click the Control line and change the Park frequency to the control channel.
In my case it’s 856.21250.





Setup UniTrunker to control SDRSharp
Copy Remote.dll from the SDRSharp directory into the UniTrunker installation directory. Remote.dll requires Microsoft Visual C++ 2010 Runtime, so you will need to download and install that as well.


Close and then reopen UniTrunker. Ensure SDRSharp is tuned to the control channel and UniTrunker is receiving the control signal.

Under the Trunking tab in SDRSharp set the “UniTrunker Install Directory” to the directory containing the ‘sdrsharptrunking.log’ file. This is the file that UniTrunker makes to tell SDRSharp which channels to tune to.

NOTE: The code currently makes the poor assumption that you’re running UniTrunker directly from the install directory. If you run it from the shortcut, you will find the ‘sdrsharptrunking.log’ file in your %AppData% directory, typically C:\Users\<username>\AppData\Roaming\UniTrunker. This is the folder you need to select, and because it does not see UniForm.exe or Remote.dll in the same directory, it may complain. Ignore that.

Check the “Delay Re-Tune Until Call Completes” box. This setting controls the level at which SDRSharp will retune back to the control frequency after an audio transmission ends. This value will need some adjusting as you go along, but to roughly set it look at the peak signal strength of the control channel, in my previous screenshots you can see it’s around -15db. Subtract another 15db or 20db and set it to that number.

Set the “Tune to Control Channel” to the known control channel frequency.




Start Listening!

At this point we can launch the Digital Speech Decoder executable and check the Enable box under Trunking in SDRSharp.




You will more than likely need to adjust the AF Gain value under the Audio dropdown. As a general rule you want to try and get the inlvl value in DSD to around 30% for the best quality audio decoding. Note that your computer may work better at another value, so experiment a little.

In my case, setting AF Gain to around 60% worked well.
Also experiment with adjusting the AGC settings in the “Front end” dialog box. Try enabling/disabling the RTL AGC, Tuner AGC, and RF Gain values to get the best signal. Note if you change the AGC values you will likely need to change the “Delay Re-Tune Until Call Completes” value as well.
Go Further
Keep in mind this setup is not ideal; it’s a basic setup using minimal components. You will not receive all transmissions and there can be a delay when retuning back to the control channel. For an optimal setup you will want to have two SDR receivers; one dedicated to the control channel and one dedicated to the signal. For information on how to configure this take a look at the UniTrunker Configuration Guide under resources.
I read somewhere that connecting the USB receiver to your computer through a USB extension cable can help reduce interference. I had an old cable lying around from a wireless mouse and it seems to work well.
Also, read over the other resources, they can help you better calibrate your setup.

Droning On: The Anatomy of A Drone

April 29, 2014 By Adam Fabio


These last few weeks I’ve been ordering parts for the Hackaday Testbed, a basic quadcopter to be used here at Hackaday. The top question I see when surfing multicopter forums is “What should I buy”. Which frame, motors, props, speed controller, and batteries are best? There aren’t easy answers to these questions with respect to larger quads (300mm or more) . There are a myriad of options, and dozens of vendors to choose from.

Advice was simple in the pre-internet days of R/C planes and helicopters: just head down to your local hobby shop, and see what lines they carry. Hook up with a local club and you’ll have some buddies to teach you to fly. This advice still holds true to a certain extent. Some hobby shops carry the DJI and Blade lines of multicopters. However, their flight control systems are closed source. If you really want to dig in and adjust parameters, you have to either buy a combo package with an open source flight control system, or buy every part separately. Unfortunately, very few local hobby shops can afford to stock individual parts at that level.

In the online world there are several “big” vendors. The classic names in the USA have always been Tower Hobbies and Horizon Hobby. Some new US-based companies are All e RC and ReadyMadeRC. Several Chinese companies, including HobbyKing andRcTimer, maintain warehouses in several parts of the world. I’m only listing a few of the big names here. If I’ve left out your favorite site, drop some info in the comments section.

The killer with many of these companies is supply. A popular component will often go out of stock with no hint as to when it will be available again. When it comes to single parts like batteries, it’s easy to just order a different size. But what about motors or speed controls? These components need to be matched on a multicopter. Changing one for a different model means changing all of them, so it pays to buy a spare or two when ordering! Click past the break for a breakdown of some multicopter parts.

Motors

Power systems have been a tough problem since the early days of radio controlled planes. Picking the right power system is a lot like picking the correct microcontroller or op-amp for a circuit design. There are a seemingly endless number of parameters to be taken into account. Once you break it down though, it isn’t too hard.

Motor part numbers are often encoded in terms of stator or can sizes. A DJI 2212 motor means it has a 22mm diameter stator which is 12mm tall. This isn’t a hard and fast rule though, so don’t live by it. The first and foremost parameter in a motor is KV - Thousands of RPM per Volt. Theoretically, an 800KV motor will turn 800 RPM on a 1V power source. A 14.8V 4S LiPo battery will spin the motor at 11,840 RPM. It’s important to remember that this is a no load rating. The motor’s RPM will drop significantly when it’s spinning a prop.

The next number to look at is the voltage the motor is rated at. Sometimes this value is represented in volts, and sometimes in cells, which usually refers to the 3.7V nominal voltage of LIPO cells. A motor capable of handling a voltage of 4S means it’s good for 4 LiPo cells in series, or 14.8V.

For the Hackaday Testbed, I went with the NTM Prop Drive 28-30S 800KV / 300W motor. These motors are low cost, and should have plenty of power for our quadcopter.
Speed Controls:

In the old days, R/C plane throttles were controlled by a servo moving a switch. It was full throttle or nothing. Thankfully those days are gone, and we have cheap MOSFETs around to give us digitally controlled throttles for our brushless motors. Speed controls are generally rated by maximum voltage and current. Figuring out which to buy is simply a matter of matching one to the motor you plan to use. Sometimes manufacturers overstate their speed control’s capabilities. Therefore, it’s often a good idea to leave a bit of overhead, lest you let out the magic smoke.

One more parameter to look at is SimonK firmware. Simon Kirby figured out that many cheap speed controls were running Atmel microcontrollers. He reverse engineered a few boards and wrote his own open source firmware with features like soft start, calibration, and easy parameter updates. Make sure the speed control you choose is compatible with SimonK firmware. Even if it is compatible, check how easy it is to flash the controller. Some controllers have easily accessible testpoints, others require soldering directly to the micrcontroller.

For the Hackaday Testbed, I went with the HobbyKing Blue Series 30Amp controller.

Batteries:

Much like speed controls, batteries will depend on the current and voltage requirements of the prop and motor combination. Lithium Polymer battery packs are sold with three basic parameters: Cell count, capacity, and maximum current. Size and weight are also important – don’t buy a battery so big your quadcopter can’t lift it!

3S and 4S batteries are common in multicopters these days. Maximum current is usually stated in therms of “C”, or the capacity of the battery. A 4000mAh battery with a rating of 45C is stating that it can supply 4 amps for 1 hour, or a maximum current of 180 Amps. It goes without saying that drawing 180 Amps is not a good idea for the overall longevity of the battery.

For the Hackaday Testbed I went with Zippy 35C constant / 45C burst 4S 4500 LiPos.
Propellers:

Multicopter Propellers can confuse even veteran pilots. Props are rated with two numbers. 9×6, 8×4, or 10×4.7 are all common propeller sizes. But what does it all mean?

The first number is diameter. The second number is pitch. Diameter is simple. A 10×4.7 propeller will have a diameter of 10 inches. Pitch is a bit harder. The pitch number of a propeller describes how far the propeller will move forward in a single revolution. If you spin a 10×4.7 propeller it will theoretically pull your plane (or quadcopter) forward 4.7 inches. A 10×6 propeller would pull forward 6 inches. Things get even more complex – how different is a 10×4.7 vs a 9×6? The answer is not much.

For the Hackaday Testbed, I’m going to test several propellers, starting with a conservative 10×4.7.
Simulating the drive system:

While propeller and overall drive system performance can be calculated by hand, a computer can be a big help. There are several software packages available to aid with propeller and drive system selection. eCalc is a website based calculator with a free trial and a subscription pay version. Make sure you select the correct calculator, as they have different versions for planes, helicopters, electric ducted fans, and multicopters. A second option is MotoCalc, which is downloadable software. MotoCalc also has a time limited trial. Freeware options are PropCalc and DriveCalc.

Nothing beats real world tests though. Years ago, the Astro Wattmeter created a small revolution in the market. The Wattmeter plugs inline with the battery and measures total current draw and voltage of the drive system. From these values it can calculate power, mAh used/remaining and several other values. One thing to remember is that a propeller will perform differently on a test bench (Static thrust) vs in the air (dynamic thrust). To this end, there are on-board Wattmeter style systems which can either send telemetry data back, or store it for later download.
If I only had a frame

Multicopter frames come in a multitude of shapes and sizes. The most basic difference between them is the number of motors they carry. Tricopters use three motors in a “Y” formation. A servo tilts the motor at the bottom of the Y to achieve yaw control. One nicety of the tricopter configuration is that all propellers turn in the same direction.This means standard airplane props can be used all around.

Moving up the chain is the quadcopter, which uses four motors and props. Quads (and all sizes beyond tricopters) use matched sets of clockwise and counterclockwise rotating propellers. When all four motors are rotating at the same rate, yaw due to torque effect is canceled out. Increasing throttle to one set of motors while decreasing to throttle on the other set allows for yaw control.

Moving beyond the basic multicopter types, we have the hexacopters and octocopters. The advantage to Hex and Octo format is of course more power! Hexes and Octos can lift more, and in some cases can keep flying if a single motor fails. Hexactopers can be laid out with six arms from a central point, or they can be in the Y-6 formation. Y-6 is essentially a tricopter with stacked counter rotating props at each point of the “Y”. Similarly octocopters can be an 8 pointed star, or an X-8 formation. Y-6 and X-8 formations offer reduced weight due to less arms, however stacked propellers are always somewhat less efficient than two propellers operating in clean air.

Another decision to make is materials. In this case the sky is basically the limit. Multicopter frames can be as simple as a couple of crossed sticks or as complex as interlocking plates with tubes of woven carbon fiber. Kits can be purchased, or designs can be hand made. If you’re scratch building, the local hardware store is often a great source of parts. I’ve seen everything from towel rod to PVC pipe pressed into service as part of a multicopter frame.



 

Cool Business Card

Making a Cooler Business Card
by ch00f via ch00ftech

New and Improved

If you've been following my blog, you probably read up on my last attempt at creating a cooler business card. The basic concept was to design a small circuit that when connected to a computer via USB will emulate a mouse and draw out a design. This utilized the ATTiny 85 and VUSB platform which makes writing USB peripherals very easy.

The problem with the original design was that I was controlling the mouse in an open loop manner. I was telling the mouse cursor which way to go, but I had no way to read back the cursor's position. I couldn't account for minor inaccuracies brought about by things like mouse acceleration settings, and the design ended up getting distorted.

After writing that post, I realized that it's possible to configure a mouse to be an absolute input device. An absolute input device is something like a graphics tablet where the device selects precisely where the mouse cursor should go.
Firmware

Most major operating systems will include drivers for so called "generic" human interface devices. This way you never get stuck with a "press any key to install keyboard driver" when you plug in a keyboard. The OS has the driver built in for most basic functions.

These basic functions are defined by the USB spec and cover common things like mouse and keyboard as well as less common peripherals like USB audio and MIDI devices. What I didn't know last time was that they also cover absolute input devices.

This is all specified by the USB device descriptor. A device descriptor is just a series of bytes that are sent to the host machine when a USB device is connected. This includes information such as the device type (mouse, keyboard, etc) as well as info like the manufacturer (USB-licensed manufacturers need to pay for their specific manufacturer IDs. My card just "borrows" one from Logitech).

I don't know anything about the physical aspects of sending a device descriptor, but fortunately, the VUSB firmware that I based my card on handles all of that and only requires that I specify a descriptor array. If you're interested in how this works, I recommend reading their code/documentation.

USB descriptors are literally just a series of bytes, so you need to put them in a very specific order for it to work. I'm not going to go into a whole lot of detail, but I will show you the descriptors I used:

0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
0x09, 0x02,                    // USAGE (Mouse)
0xa1, 0x01,                    // COLLECTION (Application)
0x09, 0x01,                    //   USAGE (Pointer)
0xa1, 0x00,                    //   COLLECTION (Physical)
0x05, 0x09,                    //     USAGE_PAGE (Button)
0x19, 0x01,                    //     USAGE_MINIMUM (Button 1)
0x29, 0x03,                    //     USAGE_MAXIMUM (Button 3)
0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
0x25, 0x01,                    //     LOGICAL_MAXIMUM (1)
0x95, 0x03,                    //     REPORT_COUNT (3)
0x75, 0x01,                    //     REPORT_SIZE (1)
0x81, 0x02,                    //     INPUT (Data,Var,Abs)
0x95, 0x01,                    //     REPORT_COUNT (1)
0x75, 0x05,                    //     REPORT_SIZE (5)
0x81, 0x03,                    //     INPUT (Cnst,Var,Abs)
0x05, 0x01,                    //     USAGE_PAGE (Generic Desktop)
0x09, 0x30,                    //     USAGE (X)
0x09, 0x31,                    //     USAGE (Y)
0x35, 0x00,                    //     PHYSICAL_MINIMUM (0)
0x46, 0x9d, 0x0b,              //     PHYSICAL_MAXIMUM (2973)
0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
0x26, 0x9d, 0x0b,              //     LOGICAL_MAXIMUM (2973)
0x65, 0x11,                    //     UNIT (SI Lin:Distance)
0x55, 0x0e,                    //     UNIT_EXPONENT (-2)
0x75, 0x10,                    //     REPORT_SIZE (16)
0x95, 0x02,                    //     REPORT_COUNT (2)
0x81, 0x02,                    //     INPUT (Data,Var,Abs)
0xc0,                          //   END_COLLECTION
0xc0                           // END_COLLECTION

The key to this whole operation is where it says INPUT (Data, Var, Abs). Those two bytes (0x81, 0x02) specify that this will be an absolute input device. Of course, reporting absolute position is very different from reporting relative movement.

For starters, when a normal mouse sends information to the host machine, it only needs to send how far the mouse has moved since the last update. This can easily be reported in a single signed byte as it updates very frequently, so distances are short.

Mapping the absolute position of the mouse however requires a lot more data if it's going to provide enough resolution for normal tasks. This is why the "REPORT_SIZE" is set to 0x10. This specifies that each report will be 16 bits in length.

With this configuration, the cursor's location will be specified with two 16 bit numbers. The size of the coordinate plane on which the cursor's location is specified is determined by the "LOGICAL_MAXIMUM" AND "LOGICAL_MINIMUM" values. The larger these numbers, the finer control you have over the mouse cursor. The numbers I used were mostly arbitrary. As long as they're larger than a typical monitor's resolution, you should be good.

One thing I noticed while playing around is that the coordinate plane actually overscans the display. This means that the cursor can actually be told to go beyond the edge of the monitor. I'm not exactly sure why this is the case, and I don't think it's even consistent between displays and operating systems. In my case, the coordinate system overscanned the edge of the display by about 300 units in every direction.

Taking that into account, the coordinate plane looked something like this:



The good news is that as long as my design is relatively small and centered in the coordinate plane, it'll make it onto the usable portion of the plane. What's also convenient is that these coordinate planes scale to the size of the screen, so it should work on anything from a netbook to a 30" monitor.
Artwork

To generate my design, I wrote a quick and dirty Python script that lets me click on an image and record the coordinates of my clicks. I designed the card's firmware so that two clicks at the same exact coordinates causes the firmware to toggle the status of the left click button. This way I just needed to double click at the beginning and end of every line I wanted to draw.

The script also split up each 16 bit coordinate into two 8 bit bytes because the AVR has an 8 bit processor and is only able to store single byte blocks in its program memory. Furthermore, you can only index 256 bytes in a single program memory array, so I had to split my design into two separate stacks of arrays that were each less than 256 bytes long.

This left me with 8 arrays:
  • Low byte of X for first half of design
  • High byte of X for first half of design
  • Low byte of Y for first half of design
  • High byte of Y for first half of design
  • Low byte of X for second half of design
  • High byte of X for second half of design
  • Low byte of Y for second half of design
  • High byte of Y for second half of design

Edit: I just remembered that AVR-GCC supports multi-dimensional program space arrays. This means that I could have just defined a 256x8 array rather than 8 separate arrays. This is the solution I used to store color mixtures in my DJ Jacket. In the end, the assembled code looks more or less the same, but I could have cleaned up my C code a bit and made this solution more scalable for larger designs.

Once compiled, the code was only slightly larger than 4 kbytes. The ATTiny 85 has 8K of memory, so I could actually make a much more sophisticated design in the future.

This process of clicking can get pretty exhausting, so I was prone to make mistakes. To help with this, I wrote another Python script that converts my mouse clicks back into an image, so I can make adjustments without having to actually flash the business card. I'm sure a more capable coder could write a script to generate this data automatically, but I'm a hardware guy, so...
Hardware





You might have noticed that I borrowed a lot of this design from Frank Zhao. He came up with the idea of obfuscating the programmer pins inside the design of the card. Six of the many exposed vias on the board connect to the six pins of the AVR programming header. The other hundred or so don't do anything at all.

Placing those vias was a blast.

The card was programmed with this small helper circuit:



The device cannot be programmed while it's connected to USB, so the + and - leads let me power the board using an external power supply during programming. These supply leads bypassed the two diode drops coming from the 5V rail (see schematic below), so as long as I kept the external supply voltage high enough, I could actually keep it connected while I plugged the device into the USB port. The diodes wouldn't conduct unless their forward voltage was greater than their potential drop.



The USB connector was taken from SparkFun Connectors Eagle library. The PCB itself wasn't thick enough to seat the card properly, so I added some solder to the pins to thicken it up a bit. This still wasn't quite enough for some USB ports, so maybe next time I'll see about ordering thicker PCB.

Also, the dongle doesn't stick out far enough for some USB hubs, so in the next version, I'll make it longer.

I was surprised to find that the ATTin85 only comes in the wide version of SOIC-8 on Digikey. This is wider than my standard footprint, and I didn't realize until I had already received the PCBs. Fortunately, I got it to work with some creative soldering:





I fixed the footprint anyway for the next version. Fortunately, I didn't have to rearrange anything else to make room.

I also included a simple set of instructions on the back of the board. For most setups, the card should work on the first try, but I also included a URL to a small page that offers some troubleshooting tips as well reassurance that this thing won't immediately upload a virus as soon as it's connected.
Performance

As you can see in the video above, the card does more or less exactly what it's supposed to. I have also tested the firmware on OSX, but the USB port of my Mac (that's actually running OSX) is shaped so that the card itself won't fit right.

I don't anticipate it working immediately for everyone, but I figure that it'll still be a fun thing for the recipient to figure out. Besides, all of the important info is printed right on the card, so if nothing else, it's a neat looking card!

Project files can be found here: Business Card v2.0

DOS(PC) Emulator for RaspBerry Pi



rpix86 v0.03 released! - Dos(PC) Emulator for RaspBerry Pi Released
via Raspberry Pi News

Homebrew Coder Pate who first off released a DOS Emulator for the Nintendo DS, then moved onto the Android has now posted a release of his DOS Emulator for the Raspberry Pi. For those who don't know a Dos Emulator lets you play old PC Games such as Doom, Duke Nukem 3D, Theme park and similar games from that period, in short an excellent way to play old games on a new device that was never intended to run the game.

The current status of the emulation is as follows:

CPU: 80486 processor, including the protected mode features (for running DOS4GW games) but without virtual memory support. The emulation runs at a speed of around 20MHz 80486 (which equals a 40MHz 80386) machine. Memory: 640KB of low memory, 4MB of EMS memory and 16MB of XMS memory.Super-VGA graphics, with a maximum resolution of 640x480 with 256 colors. SoundBlaster 2.0 (including AdLib-compatible FM sounds) sound card. US keyboard.Two-button mouse.

Here's a couple of screens from the emulator:

First off one of the emulator at StartUP:


Heres a screen showing benchmarks (Notice that the Raspberry Pi even through emulation is much faster at this still early stage)

Heres the news from the latest release:

Okay, yet another version of rpix86 is now available! During the previous week I first debugged some issues with the Logitech K400 wireless mouse/keyboard combo USB device, with the help of a Raspberry Pi forum user Jessie. Big thanks for the help! I noticed that my event file detection and handling routines did not properly handle the situation where the same event file sends both keyboard and mouse events. I made some changes to the routines, in addition to adding the event file number overriding parameters in the previous 0.02 version. After some iterations we managed to get the event system working properly in rpix86. After that I then implemented some other changes and missing features. The complete list of changes is here:

Improved support for combined keyboard/mouse USB devices (for example Logitech K400). Fixed a problem in Mode-X STOSD opcode (fixes "Settlers" black screen). Implemented read from file directly to EGA VRAM ("Heimdall"). Fixed SB command DSP_RESET to stop auto-init DMA play ("Doom").

Next I think it is time for me to work on the ax86 version for a while. You can of course still send me bug reports and enhancement requests for rpix86, especially since over 95% of the code is shared between ax86 and rpix86. If a game misbehaves on one of them, it will almost certainly misbehave also in the other version, so all game-specific enhancements and fixes will affect both emulators.

For more information and downloads, click here!