Week 5

  • Finished the arduino timers and interrupts code (although that some adjusts on frequency had to be made).
  • Creation of the message to send from the C++ node to the arduino (basically the same as the data structure previously created).
  • First contact with a flat cable (ASUS HDD cable).
  • Trying to establish the communication between the two nodes.


Week 4

  • ROS workshop by Prof. Miguel Oliveira in which a competition between the student was held.
  • Study of timers and interrupts in the arduino Mega and therefore atmega2560.
  • Study of the motors and how they worked.
  • Started to develop the arduino code using timers and interrupts to generate a pwm function manually to different pins.
  • Creation of stimulus structure.

What motors are used?

The chosen motors for this project are eccentric rotating mass (ERM) motors, more specifically DC brush motors (permanent magnet and brushes).

Typically, a ERM motor is a DC motor with an offset (non-symmetric) mass attached to the shaft. In this case, the non-symmetric mass is inside the motor capsule.

As the motor rotates, since the mass center of the non-symmetric mass is not in the physical center, there’s a net centrifugal force, which causes a displacement of the motor. Since the motor is constantly being displaced, that is perceived as vibration.

Since the velocity of the motor is proportional to the voltage, the vibration frequency also depends on it.

Connecting the terminals of the motors to a constant DC voltage source, will drive the motor at a constant speed and therefore constant frequency and vibration amplitude until the supply is switched off.

This motors work over a range of voltage, but due to some friction  and the torque needed, a start voltage of usually 0.8V needs to be provided.

info: https://www.precisionmicrodrives.com/application-notes/ab-004-understanding-erm-vibration-motor-characteristics


Mini motors experience

Experience done to the Project in Automation and Industrial Robotics, class from the Integrated Master in Mechanical Engineering of the University of Aveiro.

A program was created to control and to monitor 5 vibrator motors (cellphone ones) choosing its frequency, dutty cycle (power) and offset between all the motors.
Using RS232 protocol communication it’s possible to send the data that the user inserts in the gtk interface to the arduino, that is going to control the motors.

The main goal of this project is to observe how the motors react to different frequencies.

The pins in the Arduino Mega have a constant frequency of 490Hz.

The PWM behavior is determined by timers. Changing one pin’s frequency requires changes to the timer it connects to. However, creating custom frequencies messes up with the prescaler and requires the sacrifice of one channel. Initially, a library called PWM.h was used. However, since the Arduino Mega doesn’t have the same timers attributed to the same pins as the others, the change of prescaler had to be done by hand. For Arduino Mega, the timer 0 controls the pin 13 and 4, timer 1 controls pin 12 and 11, timer 2 controls pin 10 and 9, timer 3 controls pin 5, 3 and 2, and timer 4 controls pin 8, 7 and 6. \n
In this project the pins 3, 5, 6, 7 and 8 were used, so TIMER 3 and TIMER 4 were changed.

The frequency values, and also the offset and the dutycycle are sent by serial port using the Serial.readStringUntil() function.
The motors are controlled using the analogWrite() function from the Arduino library.

To send data from the Arduino the command sprintf and Serialprintln() was used.
Since the code has a default frequency, dutycycle and offset when no data is received, everytime new data is sent from the gtk interface, it takes some time for those values (frequency, dutycycle, etc) to be changed in the arduino, since the code starts running with the default.