Posts | Comments

Planet Arduino

Archive for the ‘mouse’ Category

Need to hook a classic Mac mouse up to your modern machine with the help of a DIY USB adapter? [John Floren] has you covered. [John]’s solution uses a board with an ATmega32U4 microcontroller on it to connect to the Mac mouse on one end, and emulate a USB HID (Human Interface Device) on the other. A modern machine therefore recognizes it like it would any other USB input device.

Why is this necessary? The connector on the classic Mac mouse may look like a familiar DE-9 connector, but it is not an RS-232 device and wouldn’t work if it were plugged into a 9-pin serial port. The classic Mac mouse uses a different pinout, and doesn’t have much for brains on the inside. It relies on the host computer to read its encoders and button states directly.

This project is actually a bit of an update to a piece of earlier work [John] did in making a vintage Depraz mouse work with modern systems. He suspected that it wouldn’t take much to have it also work with a classic Mac mouse, and he was right — all it took was updating the pin connections and adding some pull-up resistors. The source code and design files are on GitHub.

Even if one does not particularly want to use a classic Mac mouse for daily work, there’s definitely value in this kind of thing for those who deal in vintage hardware: it allows one to function-check old peripherals without having to fire up a vintage machine.

We enjoy access to cheap stuff because of the mass market for things like mice, keyboards, and cell phones. But if you need a device that doesn’t have mass appeal, you will have to pay a lot more if you can find it at all. However, with modern techniques like 3D printing and Arduino-like microcontrollers being cheap and simple to use, you now have the option to build that special one-of-a-kind device. Case in point: [Davy’s] mouse for people who have brain or nervous system disorders. This particular device is helping a 6-year-old who can’t manipulate a normal mouse.

The device uses an Arduino Pro and an MPU-6050 accelerometer and gyroscope. The original design uses machined aluminum, but 3D printing should work, too. There’s something wrong with the link to the design files in the post, but it is easy to find the correct link.

If you do 3D print a similar enclosure, you might consider using heat-set threaded inserts instead of tapping the holes. They work great, are easy to install, and seem to be a bit more robust than trying to thread plastic. Then again, threaded plastic isn’t as bad as you might think.

There are, of course, many ways you could make this work, and besides, every special user will be a little different. But what a great feeling to help someone be able to do what most people take for granted.

It’s an old misconception that digital musicians just use a mouse and keyboard for their art. This is often far from the truth, as many computer music artists have a wide variety of keyboards/synths, MIDI controllers, and “analog” instruments that all get used in their creative process. But what if one of those instruments was just a mouse?

Well, that must have been what was going through [kzra]’s mind when he turned an old ps/2 roller ball mouse into an electronic instrument. Born out of a love for music and a hate for waste, the mouse is a fully functional MIDI controller. Note pitch is mapped to the x-coordinate of the pointer, and volume (known as velocity, in MIDI-speak) is mapped to the y-coordinate. The scroll wheel can be used as a mod wheel, user-configurable but most often used to vary the note’s pitch. The mouse buttons are used to play notes, and can behave slightly differently depending on the mode the instrument is set to.

Not satisfied with simply outputting MIDI notes, [kzra] also designed an intuitive user interface to go along with the mouse. A nice little OLED displays the mode, volume, note, and mouse coordinates, and an 8×8 LED matrix also indicates the note and volume. It’s a fantastic and versatile little instrument, and you’ve gotta check out the video after the break to see it for yourself. We’ve seen some awesome retro-tech MIDI controllers before, and this fits right in.

Thanks to [midierror] for the tip!

Phone screens keep getting bigger. Computer screens keep getting bigger. Why not a large trackpad to use as a mouse? [MaddyMaxey] had that thought and with a few components and some sewing skills created a trackpad in a tablecloth.

The electronics in this project are right off the shelf. A Flora board for the brains and 4 capacitive touch boards. If you haven’t seen the Flora, it is a circular-shaped Arduino made for sewing into things. The real interesting part is the construction. If you haven’t worked with conductive fabric and thread, this will be a real eye-opener. [Maddy’s] blog has a lot of information about her explorations into merging fabric and electronics and also covers things like selecting conductive thread.

As an optional feature, [MaddyMaxey] added vibration motors that provide haptic feedback to her touchpad. We were hoping for a video, but there doesn’t seem to be one. The code is just the example program for the capacitive sensor boards, although you can see in a screenshot the additions for the haptic motors.

We’ve covered the Flora before, by the way. You could also make a ridiculously large touch surface using tomography, although the resolution isn’t quite good enough for mouse purposes.


Filed under: Arduino Hacks, wearable hacks

[Nicolas Berger] submits his six degree of freedom mouse project. He hopes to do things like control a robot arm or fly an alien mothership.

We thought the construction was really neat; suspending a wooden ball in the middle of three retractable key rings. By moving the ball around you can control the motion of a cube displayed on the computer. We first thought this was done by encoders or potentiometers measuring the amount of string coming out of the key fobs. However, what’s actually happening is a little bit cleverer.

[Nicolas] has joined each string with its own 2 axis joystick from Adafruit. He had some issues with these at first because the potentiometers in the joysticks weren’t linear, but he replaced them with a different module and got the expected output. He takes the angle values from each string, and a Python program numerically translates the output from the mouse into something the computer likes. The code is available on his GitHub. A video of the completed mouse is after the break.


Filed under: Arduino Hacks, peripherals hacks

[Ido Gendel] was thinking about new and interesting ways to send data between devices, when he realized that the answer was right in his hand. Literally: he decided to try sending data using the mouse pointer. What he came up with was an interesting hack that uses small movements of the mouse pointer to send data at up to 1200bps, or about 150 bytes per second.

The way he did this was very, very clever. He used an Arduino Leonardo that is set to emulate a mouse, working alongside his existing mouse. This setup means that he can use his existing mouse: the system just sees the Arduino as a second mouse, and the pointer just looks a little jerky when you zoom in. That is because the Arduino is just sending tiny movements, each of which is a code that represents a nybble (4 binary bits) of data. By using both a combination of three left-right or up-down movements, he was able to create 16 movements, each of which can encode 4 bits of data. Each of these encoding movements also returns the mouse to its origin point, so the mouse doesn’t mysteriously scroll off the screen when data is being sent.

The encoding scheme used by [Ido].
The encoding scheme used by [Ido].
On the computer, a custom program detects and decodes this movement, recreating the stream of data. In his example, this is data from a photoresistor, but it could be anything from random data to the contents of a secret file.

Of course, this isn’t a practical way of sending secret data: it only works when the custom program is active, 150 bytes per second is rather slow and enabling mouse acceleration in Windows stops it working because it masks the small movement. But it is an awesome hack that shows how you can send data in ways that you might not first think of. When you are trying to make a device as simple as possible, this is an important lesson to learn.


Filed under: Arduino Hacks, peripherals hacks
Lug
05

The Rabbit H1 is a Stationary Mouse Replacement

3D printing, arduino, arduino hacks, CNC, controller, mouse, openscad, Teensy Commenti disabilitati su The Rabbit H1 is a Stationary Mouse Replacement 

rabbit h1

[Dave] has some big plans to build himself a 1980′s style computer. Most of the time, large-scale projects can be made easier by breaking them down into their smaller components. [Dave] decided to start his project by designing and constructing a custom controller for his future computer. He calls it the Rabbit H1.

[Dave] was inspired by the HOTAS throttle control system, which is commonly used in aviation. The basic idea behind HOTAS is that the pilot has a bunch of controls built right into the throttle stick. This way, the pilot doesn’t ever have to remove his hand from the throttle. [Dave] took this basic concept and ran with it.

He first designed a simple controller shape in OpenSCAD and printed it out on his 3D printer. He tested it out in his hand and realized that it didn’t feel quite right. The second try was more narrow at the top, resulting in a triangular shape. [Dave] then found the most comfortable position for his fingers and marked the piece with a marker. Finally, he measured out all of the markings and transferred them into OpenSCAD to perfect his design.

[Dave] had some fun with OpenSCAD, designing various hinges and plywood inlays for all of the buttons. Lucky for [Dave], both the 3D printer software as well as the CNC router software accept STL files. This meant that he was able to design both parts together in one program and use the output for both machines.

With the physical controller out of the way, it was time to work on the electronics. [Dave] bought a couple of joysticks from Adafruit, as well as a couple of push buttons. One of the joysticks controls the mouse cursor. The other joystick controls scrolling vertically and horizontally, and includes a push button for left-click. The two buttons are used for middle and right-click. All of these inputs are read by a Teensy Arduino. The Teensy is compact and easily capable of emulating a USB mouse, which makes it perfect for this job.

[Dave] has published his designs on Thingiverse if you would like to try to build one of these yourself.

 


Filed under: Arduino Hacks
Mar
31

A Real Malware In A Mouse

arduino hacks, mouse, peripherals hacks, Security Commenti disabilitati su A Real Malware In A Mouse 

mouseagain

After reading an April Fools joke we fell for, [Mortimer] decided to replicate this project that turns the common USB mouse into a powerful tool that can bring down corporations and governments. Actually, he just gave himself one-click access to Hackaday, but that’s just as good.

The guts of this modified mouse are pretty simple; the left click, right click, and wheel click of the mouse are wired up to three pins on an Arduino Pro Micro. The USB port of the ‘duino is configured as a USB HID device and has the ability to send keyboard commands in response to any input on the mouse.

Right now, [Mortimer] has this mouse configured that when the left click button is pressed, it highlights the address bar of his browser and types in http://www.hackaday.com. Not quite as subversive as reading extremely small codes printed on a mousepad with the optical sensor, but enough to build upon this project and do some serious damage to a computer.

Video of [Mort]‘s mouse below.


Filed under: Arduino Hacks, peripherals hacks
Giu
20

First Look – the Arduino Leonardo

32u4, arduino, ATmega, eleven, emulation, freetronics, hid, keyboard, leonardo, LeoStick, mouse, review, tronixstuff, tutorial, uno, USB Commenti disabilitati su First Look – the Arduino Leonardo 

Introduction

Recently the Arduino Leonardo was released, and I’ve finally got my hands on one. Some have claimed that the Leonardo as the successor to the Arduino Uno board, however that is somewhat subjective.  In this article we have a look for ourselves and examine the differences between the Uno boards that we’re used to and the new Leonardo.

The board

Here it is unwrapped from the cardboard packet:

It uses the same physical footprint as the Uno, so no surprises there:

 Now to travel around the board and see what’s new. First is the microcontroller – we have the Atmel ATmega32U4:

There are several pros and cons to using the 32U4. The pros include:

  • More analogue inputs. As well as the usual A0~A5, digital pins 4,6,8,9,10 and 12 can be configured as A6~A11
  • It handles USB. So no more external USB controller MCU or the old FTDI chip. Supposedly this saves money, however the retail price in some markets don’t reflect this
  • More PWM pins – well one more. They’re now on D3, 5, 6, 9, 10, 11 and 13
  • There is a little more SRAM than the Uno, it is now 2.5 kB
  • SPI has moved – they’re now wired to the ICSP pins. So you now have D10~D13 seperate to SPI
And the cons:
  • SPI has moved – they’re now wired to the ICSP pins. So if you have any shields that use SPI – too bad, they’re out. The most common example of this will be Ethernet shields – you’ll need to modify them with some jumper leads to contact the ICSP pins
  • I2C has moved over to D2+3. So if you have any shields using I2C – they’ll need to be modified
  • Less flash memory – the bootloader uses 4 kB of the 32 kB flash (the Uno used 0.5 kB)

However you can get an adaptor shield to use older Arduino shields with the Leonardo.

For MCU to Arduino pin mapping, see here. Next, for more on the USB side of things – as the 32U4 takes care of USB – take heed of the following notes from arduino.cc:

Since the Leonardo does not have a dedicated chip to handle serial communication, it means that the serial port is virtual– it’s a software routine, both on your operating system, and on the Leonardo itself. Just as your computer creates an instance of the serial port driver when you plug in any Arduino, the Leonardo creates a serial instance whenever it runs its bootloader. The Leonardo is an instance of USB’s Connected Device Class (CDC) driver.

This means that every time you reset the board, the Leonardo’s USB serial connection will be broken and re-established. The Leonardo will disappear from the list of serial ports, and the list will re-enumerate. Any program that has an open serial connection to the Leonardo will lose its connection. This is in contrast to the Arduino Uno, with which you can reset the main processor (the ATmega328P) without closing the USB connection (which is maintained by the secondaryATmega8U2 or ATmega16U2 processor).

There are some other changes to the board. Moving on, the next change is the USB socket. Do you recognise this socket?

Yes – micro USB. Thankfully (!) a growing number of mobile phones use this type for charging and USB connection, so you may already have a matching cable. Note that the Leonardo doesn’t include a cable, so if you’re an iPhone user – order yourself a cable with your Leonardo.

Next, the LEDs have been moved to the edge of the board. You can see them in the above image to the right of the USB socket. No more squinting through shields at strange angles to check the TX/RX lights. However this isn’t a new invention, our friends at Freetronics have been doing this for some time. Furthermore, the reset button has been moved to the corner for easier access.

There are also seperate connectors for the I2C bus – next to AREF, which should make modifying existing shields a little easier:

 Finally, due to the reduction in components and shift to SMD – there is what could almost be called a large waste of space on the board:

A few extra user LEDs wouldn’t have been a bad idea, or perhaps circuitry to support Li-Po rechargeable batteries. However the argument will be “that’s what a protoshield is for”. Just saying… As for the rest of the hardware, the specifications can be found here.

Finally, the Leonardo is available in two versions – with and without headers. This makes it easier to embed the Leonardo into fixed applications as you can directly solder to the various I/O pins. An alternative to this would instead be the Freetronics LeoStick, as it is much smaller yet fully compatible.

Software

First – you need to drag yourself into Arduino IDE v1.0.1. Note you can run more than one version of the IDE on the same machine if you don’t mind sharing the same preferences file. Next, the Leonardo doesn’t reset when you open the serial monitor window (from arduino.cc) -

That means you won’t see serial data that’s already been sent to the computer by the board, including, for example, most data sent in the setup() function. This change means that if you’re using any Serial print(), println() or write() statments in your setup, they won’t show up when you open the serial monitor. To work around this, you can check to see if the serial port is open like so:

 // while the serial stream is not open, do nothing:
   while (!Serial) ;

Using the 32U4, you also have two serial ports. The first is the emulated one via the USB, and the second is the hardware UART on digital pins 0 and 1. Furthermore, the Leonardo can emulate a USB keyboard and mouse – however with a few caveats. There is a section on the Leonardo homepage that you should really read and take note of. But this emulation does sound interesting, and we look forward to developing some interesting tools to take use of them, so stay tuned.

Conclusion

There is nothing wrong with the Leonardo board, it works as described. However you could consider this a virtual “line in the sand”, or a new beginning. Due to the changes in the pinouts shields will need to be redesigned, and for those of you still programming in Arduino v23 – it’s time to get up to speed with v1.0.1. If you need the special USB functions, keyboard and/or mouse emulation, or are happy with the changes and can get one for less than the cost of a Uno – great.

Here’s a video from the main man Massimo Banzi:

However if you’re looking for your first Arduino board – this isn’t the board for you right now. There are too many incompatible shields out there, and the inability to cheaply replace the microcontroller will see some beginners burn out their first couple of boards rendering them useless. Get yourself an Arduino Uno or compatible board such as the Freetronics Eleven.

In conclusion, classifying the Leonardo board as good or bad is not a simple decision. It may or may not be an improvement – depending on your needs. Right now – for beginners, this is not the board for you. For those who understand the differences between a Uno and Leonardo, sure – no problem. Frankly, I would get a LeoStick instead.  At the end – it’s up to you to make an informed decision.

If you have any comments, leave them below. Thanks to Little Bird Electronics for the use of the Arduino Leonardo board.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Giu
20

Introduction

Recently the Arduino Leonardo was released, and I’ve finally got my hands on one. Some have claimed that the Leonardo as the successor to the Arduino Uno board, however that is somewhat subjective.  In this article we have a look for ourselves and examine the differences between the Uno boards that we’re used to and the new Leonardo.

The board

Here it is unwrapped from the cardboard packet:

It uses the same physical footprint as the Uno, so no surprises there:

 Now to travel around the board and see what’s new. First is the microcontroller – we have the Atmel ATmega32U4:

There are several pros and cons to using the 32U4. The pros include:

  • More analogue inputs. As well as the usual A0~A5, digital pins 4,6,8,9,10 and 12 can be configured as A6~A11
  • It handles USB. So no more external USB controller MCU or the old FTDI chip. Supposedly this saves money, however the retail price in some markets don’t reflect this
  • More PWM pins – well one more. They’re now on D3, 5, 6, 9, 10, 11 and 13
  • There is a little more SRAM than the Uno, it is now 2.5 kB
  • SPI has moved – they’re now wired to the ICSP pins. So you now have D10~D13 seperate to SPI
And the cons:
  • SPI has moved – they’re now wired to the ICSP pins. So if you have any shields that use SPI – too bad, they’re out. The most common example of this will be Ethernet shields – you’ll need to modify them with some jumper leads to contact the ICSP pins
  • I2C has moved over to D2+3. So if you have any shields using I2C – they’ll need to be modified
  • Less flash memory – the bootloader uses 4 kB of the 32 kB flash (the Uno used 0.5 kB)

However you can get an adaptor shield to use older Arduino shields with the Leonardo.

For MCU to Arduino pin mapping, see here. Next, for more on the USB side of things – as the 32U4 takes care of USB – take heed of the following notes from arduino.cc:

Since the Leonardo does not have a dedicated chip to handle serial communication, it means that the serial port is virtual– it’s a software routine, both on your operating system, and on the Leonardo itself. Just as your computer creates an instance of the serial port driver when you plug in any Arduino, the Leonardo creates a serial instance whenever it runs its bootloader. The Leonardo is an instance of USB’s Connected Device Class (CDC) driver.

This means that every time you reset the board, the Leonardo’s USB serial connection will be broken and re-established. The Leonardo will disappear from the list of serial ports, and the list will re-enumerate. Any program that has an open serial connection to the Leonardo will lose its connection. This is in contrast to the Arduino Uno, with which you can reset the main processor (the ATmega328P) without closing the USB connection (which is maintained by the secondaryATmega8U2 or ATmega16U2 processor).

There are some other changes to the board. Moving on, the next change is the USB socket. Do you recognise this socket?

Yes – micro USB. Thankfully (!) a growing number of mobile phones use this type for charging and USB connection, so you may already have a matching cable. Note that the Leonardo doesn’t include a cable, so if you’re an iPhone user – order yourself a cable with your Leonardo.

Next, the LEDs have been moved to the edge of the board. You can see them in the above image to the right of the USB socket. No more squinting through shields at strange angles to check the TX/RX lights. However this isn’t a new invention, our friends at Freetronics have been doing this for some time. Furthermore, the reset button has been moved to the corner for easier access.

There are also seperate connectors for the I2C bus – next to AREF, which should make modifying existing shields a little easier:

 Finally, due to the reduction in components and shift to SMD – there is what could almost be called a large waste of space on the board:

A few extra user LEDs wouldn’t have been a bad idea, or perhaps circuitry to support Li-Po rechargeable batteries. However the argument will be “that’s what a protoshield is for”. Just saying… As for the rest of the hardware, the specifications can be found here.

Finally, the Leonardo is available in two versions – with and without headers. This makes it easier to embed the Leonardo into fixed applications as you can directly solder to the various I/O pins. An alternative to this would instead be the Freetronics LeoStick, as it is much smaller yet fully compatible.

Software

First – you need to drag yourself into Arduino IDE v1.0.1. Note you can run more than one version of the IDE on the same machine if you don’t mind sharing the same preferences file. Next, the Leonardo doesn’t reset when you open the serial monitor window (from arduino.cc) -

That means you won’t see serial data that’s already been sent to the computer by the board, including, for example, most data sent in the setup() function. This change means that if you’re using any Serial print(), println() or write() statments in your setup, they won’t show up when you open the serial monitor. To work around this, you can check to see if the serial port is open like so:

// while the serial stream is not open, do nothing:
while (!Serial) ;

Using the 32U4, you also have two serial ports. The first is the emulated one via the USB, and the second is the hardware UART on digital pins 0 and 1. Furthermore, the Leonardo can emulate a USB keyboard and mouse – however with a few caveats. There is a section on the Leonardo homepage that you should really read and take note of. But this emulation does sound interesting, and we look forward to developing some interesting tools to take use of them, so stay tuned.

Conclusion

There is nothing wrong with the Leonardo board, it works as described. However you could consider this a virtual “line in the sand”, or a new beginning. Due to the changes in the pinouts shields will need to be redesigned, and for those of you still programming in Arduino v23 – it’s time to get up to speed with v1.0.1. If you need the special USB functions, keyboard and/or mouse emulation, or are happy with the changes and can get one for less than the cost of a Uno – great.

Here’s a video from the main man Massimo Banzi:

However if you’re looking for your first Arduino board – this isn’t the board for you right now. There are too many incompatible shields out there, and the inability to cheaply replace the microcontroller will see some beginners burn out their first couple of boards rendering them useless. Get yourself an Arduino Uno or compatible board such as the Freetronics Eleven.

In conclusion, classifying the Leonardo board as good or bad is not a simple decision. It may or may not be an improvement – depending on your needs. Right now – for beginners, this is not the board for you. For those who understand the differences between a Uno and Leonardo, sure – no problem. Frankly, I would get a LeoStick instead.  At the end – it’s up to you to make an informed decision.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

The post First Look – the Arduino Leonardo appeared first on tronixstuff.



  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook