Tuesday, December 15, 2009

Programming and Electronics

Using complex programming we were able to create a virtual response that mimicked that of a conventional drumhead. For the expo we decided to use our snare drum response that we recorded and characterized. Another important piece of our program was that we were able to eliminate the annoying buzz sound coming from our motor. Thanks is due to Josh's group for creating this code and allowing us to use it. More details of our programming and electronics used will be discussed below.

As our goal is to produce a haptic force feedback to the user, the force that is felt by the user can only be transferred to the user hand through the drumstick, and this only happens when the drumstick is in contact with the drumpad. Therefore, all the necessary force and movement of the drumpad only matters during this split-second moment and the remaining response of the drumpad does not contribute to the feedback felt by the user. So, we need to program the motor to give an impulse force at the instant the drumstick hits the drumpad, where the impulse response of the drumpad is similar to the waveform we recorded from the tom and snare earlier. Particularly, we are looking for the amplitude of the drumpad's maximum acceleration to match with the first few part of the waveform data.

First, we need estimate how much current is needed to produce the necessary acceleration, which we need roughly 0.5 g (5 m/s²) based from our waveform data. We got the mass of the motor's plate from our parametrization of the motor constant, which is 115 grams. From these values, we got that the current required to actuate the motor at that acceleration to be 170 mA. The power supply we used can produce more than 250 mA, which is more than enough for our design.

After we get the initial displacement from the hit and the impulse force, we use position control to get the drumpad back to its original position. We were thinking of using a PD control to match the decay rate of our recorded waveform. However, when we tried normal proportional control we actually get a decaying system, which settled down quite fast. This means that our system also has a damping inside it, which makes this a 2nd order system if we use proportional control. Since the proportional control worked, we decided to just use proportional control for our system. The block diagram for our control system can be seen below.

Figure 1: System's Block Diagram

Now with our mechanical control done, we need to get the sound to work. We used the Arduino to send MIDI signal into Pure Data (pd) through a MIDI USB port. We set the the program inside pd to run a sound file (in the case we used for the expo was snare) whenever Arduino registers a hit. You can see what the pd interface looks like below.


Figure 2: Screenshot of the pd Interface

1 comment:

  1. This comment is for the post on characterization as well as this post. It is intriguing that the attempt was made to replicate the impulse response shown in the characterization. We are keen to know how closely were you able to emulate the response. The curiosity is elevated by the fact that the period of the measured response was really small making it difficult to actually replicate the it (considering the motors available in the lab).

    ReplyDelete