Jump to content

Search the Community

Showing results for tags 'Arduino'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Pin Board
    • Announcements
    • Giveaways
  • The Mod Zoo Official Podcasts & Weekly Staff Hangout
    • Official Podcast Episodes
    • Questions and Discussion!
    • Weekly Staff Hangout
  • Tech News
    • Latest Tech News
    • 2015 CES Consumer Electronics Show Coverage
    • 2016 CES - Consumer Electronics Show Coverage
    • 2017 CES - Consumer Electronics Show Coverage
  • Project Central
    • The Mod Zoo Staff
    • Featured Projects
    • Member Worklogs
    • Maker or Non-PC Worklogs
  • TMZ Review Central
    • Reviews
  • PimpRig / PCApex Alumni Community
    • PimpRig / PCApex General Discussion
    • PimpRig / PCApex Member Project Logs
    • PimpRig / PCApex Member Project Archives
  • The Picnic Area
    • General Discussion
    • Drawing Board
    • The Water Park
    • Member Reviews and Unboxings
    • The Machine Shop
    • Modding Guides
    • Repair Guides
    • Overclocking
    • Recomended Ebay sellers
    • Comments & Suggestions
  • Food Court
    • The Mod Zoo Gift Shop
    • MNPCTech
    • Smart Computer Store
    • Mayhems
  • The Storage Area

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hello modZoo, I thought it would be nicer to open a dedicated thread, instead of posting the progress in my generic "Drawing board". Below is the compiled version of my previous posts: A few month ago, I bough a vintage PS/2 Trackball from the CH Products brand. I must say that I'm very impressed by the quality of this device. It well derserves its title of "Model M of the trackballs". The trackball was advertised as being the PS/2 variant, but unfortunatly it is not. In fact, it uses a pretty old connector and protocol called : BUS mouse. The bus mouse connector is very similar to the PS/2, with the same 5/16" diameter, but it as 9 pins instead of 6. I can't blame the seller, as PS/2 and BUS can easily been mixed up. Unlike PS/2, serial or USB devices, absolutly NO LOGIC is done on the device side. BUS mouse devices send the raw data from the optomechanical encoders and buttons to a decoding card on the computer side. The connector has the following pins:XA (X axis encoder channel 1)XB (X axis encoder channel 2)YA (Y axis encoder channel 1)YB (Y axis encoder channel 2)Switch 1Switch 2Switch 3+5VGroundYou've probably spotted that, despite having 4 buttons, the connector only carries 3 switches informations. In fact, the top buttons acts as middle-click (both of them) or as click-lock (left lock and right lock). Everything is configurable thanks to 8 DIP switches below the device. Fortunatly, all is not so bad:The cable is connected to a header so that changing it will be easier.The pinout is provided on both manual and PCBThe controller is an 8bit PIC16C55 with a DIP28 package. How do the encoders work: They are based on quadrature encoders and consists on a shaft wheel and 2 optical sensors per axis. When the shaft spins, it generates 2 electrical signals phased out by 90 degrees. Note that encoders with a single channel can only give a speed information, 2 channels are mandatory in order to computer CW or CCW rotation. The picture above, shows that there're 3 achievable count speeds:x1 if you count on channel A rising edge onlyx2 if you count on channel A rising edge and falling edgex4 if you count on both channel A and B rising and falling edges Retro-mod operation: After several tests using an Arduino Mega 2560 rev2 board, I bought a Teensy++ 2.0 as it supports the HID protocol. At the moment, it is connected it to the BUS Mouse cable header. The quadrature encoders are handled by interrupt, on both FALLING and RISING transitions. Buttons states are handled by the background loop and updated every 10 microseconds, along with relative coordinates updates if anything happened on the encoders side. The video below shows a quick demonstration of the trackball in use. What's left to do: Next step will be to either put the Teensy inside the trackball case or use it as as inline adapter. The later option would require a 3D printed case. Another cool option, that would match the retro-tech theme of this project, would be a controller board. Bus mouse pointing devices were used with specific controller board (like the one pictured below), where all the logic were done. The basic idea would be to connect the Teensy to an internal USB header of the motherboard and run the required pins the a connector attached to a PCI bracket. A PCB, with the Teensy socketed into it, could be used for a genuine retro look :D. Kind of link the pictured Microsoft InPort card, but with the Teensy in place of the PIC and a blank / dummy PCIe connector to secure the board in place. Below is the current code for this project: I will upgrade it through the revisions./* ============================================================================================ Author : GuilleAcoustic Date : 2015-02-18 Revision: V1.0 Purpose : Opto-mechanical trackball firmware -------------------------------------------------------------------------------------------- Wiring informations: -------------------------------------------------------------------------------------------- - GND / Black : Gnd - VCC / White : Vcc (+5V) - Pin_D0 / Green : X axis encoder / channel A - Pin_D1 / Blue : X axis encoder / channel B - Pin_D2 / Violet : Y axis encoder / channel A - Pin_D3 / Gray : Y axis encoder / channel B - Pin_D4 / Orange : Switch 1 - Pin_D5 / Red : Switch 2 - Pin_D6 / : not connected - Pin_D7 / Brown : Switch 3 -------------------------------------------------------------------------------------------- Note: The Pin_D6 must not be used on Teensy++ 2.0 as it controls the embedded LED ============================================================================================ */// --------------------------------------------// Constant for binary mask// --------------------------------------------#define _SWITCH_1 B00010000#define _SWITCH_2 B00100000#define _SWITCH_3 B10000000// --------------------------------------------// Type definition// --------------------------------------------typedef struct{ byte coordinate; byte state; byte stateMachine [4]; byte shift; byte bitMask;} ENCODER_;// --------------------------------------------// Global variables// --------------------------------------------volatile ENCODER_ X_Axis;volatile ENCODER_ Y_Axis;// =====================================================================// the setup function runs once when you press reset or power the board// =====================================================================void setup(){ // -------------------------------------------- // Set the whole port D as input // -------------------------------------------- DDRD = B00000000; delay(100); // -------------------------------------------- // Initialize encoders informations // -------------------------------------------- static byte initTable [4] = {0, 1, 3, 2}; X_Axis.coordinate = 0; X_Axis.shift = 0; X_Axis.stateMachine[0] = B00000000 << X_Axis.shift; X_Axis.stateMachine[1] = B00000001 << X_Axis.shift; X_Axis.stateMachine[2] = B00000011 << X_Axis.shift; X_Axis.stateMachine[3] = B00000010 << X_Axis.shift; X_Axis.bitMask = B00000011 << X_Axis.shift; X_Axis.state = initTable [(PIND & X_Axis.bitMask) >> X_Axis.shift]; Y_Axis.coordinate = 0; Y_Axis.shift = 2; Y_Axis.stateMachine[0] = B00000000 << Y_Axis.shift; Y_Axis.stateMachine[1] = B00000001 << Y_Axis.shift; Y_Axis.stateMachine[2] = B00000011 << Y_Axis.shift; Y_Axis.stateMachine[3] = B00000010 << Y_Axis.shift; Y_Axis.bitMask = B00000011 << Y_Axis.shift; Y_Axis.state = initTable [(PIND & Y_Axis.bitMask) >> Y_Axis.shift]; // -------------------------------------------- // Attach interruption to Axis sensors // -------------------------------------------- attachInterrupt(PIN_D0, ISR_HANDLER_X, CHANGE); attachInterrupt(PIN_D1, ISR_HANDLER_X, CHANGE); attachInterrupt(PIN_D2, ISR_HANDLER_Y, CHANGE); attachInterrupt(PIN_D3, ISR_HANDLER_Y, CHANGE); // -------------------------------------------- // Communication bus // -------------------------------------------- Serial.begin(115200); Mouse.begin();}// =====================================================================// the loop function runs over and over again forever// =====================================================================void loop(){ // -------------------------------------------- // Update mouse coordinates // -------------------------------------------- if (X_Axis.coordinate != 0 || Y_Axis.coordinate != 0) { Mouse.move(X_Axis.coordinate, Y_Axis.coordinate); X_Axis.coordinate = 0; Y_Axis.coordinate = 0; } // -------------------------------------------- // update buttons state // -------------------------------------------- byte buttons = PIND; Mouse.set_buttons(!(buttons & _SWITCH_1), !(buttons & _SWITCH_2), !(buttons & _SWITCH_3)); // -------------------------------------------- // Wait a little before next update // -------------------------------------------- delay(10);}// =====================================================================// Interrupt handlers// =====================================================================// -----------------------------------------------// Horizontal axis sensor// -----------------------------------------------void ISR_HANDLER_X(){ // X axis encoder handling if ((PIND & X_Axis.bitMask) == X_Axis.stateMachine[(X_Axis.state + 1) % 4]) { X_Axis.state = (X_Axis.state + 1) % 4 ; X_Axis.coordinate++ ; } else { X_Axis.state = (X_Axis.state + 3) % 4 ; X_Axis.coordinate-- ; }}// -----------------------------------------------// Vertical axis sensor// -----------------------------------------------void ISR_HANDLER_Y(){ // Y axis encoder handling if ((PIND & Y_Axis.bitMask) == Y_Axis.stateMachine[(Y_Axis.state + 1) % 4]) { Y_Axis.state = (Y_Axis.state + 1) % 4 ; Y_Axis.coordinate++ ; } else { Y_Axis.state = (Y_Axis.state + 3) % 4 ; Y_Axis.coordinate-- ; }}Compilation report: Binary sketch size: 5,650 bytes (of a 130,048 byte maximum)Estimated memory use: 116 bytes (of a 8,192 byte maximum)
×
×
  • Create New...