![how to use darwiinremote how to use darwiinremote](https://img.wonderhowto.com/img/07/55/63475238376757/0/turn-parental-controls-mac-os-x.300x140.jpg)
The serial port code serialPort.c includes various functions, but the main functions we used were serialPort (int x, int y), OpenSerial (bsdPath) (internally called by serialPort ), and InitializeModem (int x, int y, int pressed). These values are important for servo calibration control. If the WiiRemote sees no IR source, then the x and y IR data values are both 1023. Within the DarwiinRemote application, the x-coordinate IR data ranges from 0 to 1023 and y-coordinate IR data ranges from 0 to 767. After downloading the application and the WiiRemoteFramework library source code from Source forge, with the XCode IDE we are able to locate where IR data and button status data are in the source code, open a serial port by calling the open serial port C code acquired from the Apple Developer website, and write data to the USB to serial connection located on the dev port of the MacBook hardware. Within the DarwiinRemote application, the package includes a amework, which is the binary for the WiiRemote library on the Macintosh.
![how to use darwiinremote how to use darwiinremote](https://i.ytimg.com/vi/2UNnr1-P9os/mqdefault.jpg)
How to use darwiinremote driver#
We use the MacBook to port the Wiimote’s IR data since MacBook has Bluetooth functionality built in, and by downloading a Wiimote driver on the MacBook (open source driver DarwiinRemote), we extract the IR data from the Wiimote and send it through the USB-to-serial connection
![how to use darwiinremote how to use darwiinremote](https://www.aes.org/images/e-lib/thumbnails/1/5/15083_full.png)
Here we only use the receive portion on the microcontroller to receive the Wiimote’s IR data from a MacBook. A Wiimote view is 41° in x direction and 31° in y direction.Ĭommunicating between the Wiimote and the MCU is established through the USB serial RS232 input using the serial UART receive/transmit feature on the Mega32. In our project we use the infrared camera and its ability to track an infrared source’s x-y coordinates within the Wiimote’s plane of view. With these two devices, the players communicate with the main console via Bluetooth. The Wiimote has two types of sensors: accelerometers and an infrared camera. The hardest part of setting up the PWM signals was configuring the servos to be in the correct position and varying the pulses to the right degree to move the servo arm where we wanted it. In the timer1 compare match interrupt we set up a custom PWM signal to control the gripper servo. Timer 1 is set to clear on match mode running at 5KHz. We use this period as one PWM cycle and set OCR0 (or OCR2) to vary the width of the pulse. Since they are 8-bit timers they overflow with a period of roughly 16ms.
How to use darwiinremote full#
For timer0 and timer2 we run them on full PWM mode with the prescalar set so they run at clk/1024 = 15.625 KHz. We use three timers to set up the PWM signals used in this project. We do not intend to commercialize our design so this should not be an issue. The Wiimote was designed by Nintendo, though I haven’t found a patent for the Wiimote itself. Our project uses the Bluetooth wireless protocol, which is a built-in feature of the Macbook as well as the Wiimote. Relation to Standards and Intellectual Property Fortunately the servo doesn’t have to be in a precise position for the crane to work, it only has to be roughly controllable. Only two timers on the Mega32 have PWM capabilities (Timer0/Timer2), so we had to manually generate a PWM signal, which sacrificed some accuracy on our timing. We needed to generate three PWM signals to control the three servo motors. The explanations for these concepts come up in the later sections of this report.
![how to use darwiinremote how to use darwiinremote](https://image.slidesharecdn.com/prototypingincode-110226184830-phpapp02/85/prototyping-in-code-14-320.jpg)
We also needed some basic circuit design skills for building the LED array. We needed to understand how the Wii’s IR camera worked and also needed to be good at PWM signals for the servo motors. There wasn’t any extremely challenging math involved in our project. We decided to use the remote to track infrared points and use this data to control a crane composed of three servos with a gripper. Our first idea was to track points using two Wiimotes in 3-d, but the difficulty of getting just one Wiimote to work scratched that idea. The servos are controlled by PWM signals sent by the Mega32 MCU, and these signals are generated from parsing the received IR data from a serial connection with a Macbook wirelessly connected through Bluetooth to the Wiimote.Īfter watching some of Johnny Chung Lee’s videos on Wiimote hacks(), especially the infrared tracking video, we were inspired to create our own Wiimote application. Our crane is composed of three servo motors, one of which is connected to a gripper. The Wiimote is a powerful gadget and we wanted to build a new hack with it. We used the Wiimote’s IR tracking capability and Bluetooth to wirelessly control a robotic crane arm.