Output Devices

Designing of the board

For the designing of the board, I used the satshakit created by Daniele Ingrassia as a reference point. I started with the initial board of the satshakit and then started modifying it according to the needs of the output device I wanted to use. So, for this task I wanted to control at least two to three servo motors. A servo motor has three connections, two are for VCC and GND and the other one is for the signal that usually connects to a PWM pin of the microcontroller. So, initially I deleted all the pins of the microcontroller and then added again MISO, MOSI, SCK, RST, TX, RX, another RST and 6 PWM available pins. The first four pins added are useful for the programming of the board with the help of the programmer and the three last (TX, RX and RST) are used for the programming of the board with the FTDI cable. Also, I added more pins for the VCC and GND. Lastly, I designed pins for 5V regulators so that I can draw more current out of batteries. I did this because the PCB has not enough power in order to operate a lot of servo motors, so I had to find a way to put more current in the board but not more voltage. I added three voltage regulators just to be sure I can draw enough current. Although, there is a concern about the dc/dc regulators reaction when they are connected in series.

Below, you can firstly see the initial board of satshakit and then the modified one next to it:

Apart from the satshakit as the reference, when modifying it I had to take a reference of the pinout of the microcontroller. The reference I used was the picture below. This picture clearly shows the relation between ATmega328P and the Arduino pinouts. It comes in handy while I was doing my tests with the Arduino board before I actually proceed to produce my own board.

As I am using the ATmega328p microcontroller, the same one the Arduino uses, I tried to move one servo motor with it in order to know how much current one servo motor needs to move. The result of the test showed that one servo motor needs a mean of 0.47A in order to move, and according to the Arduino Website, it can sink a total of 400mA. So, for more than two servo motors, an external battery supply will be needed.

Milling and Soldering of the Board

So, after the design of the board was ready, I followed the same procedure I used on the Electronics Design week. That means I exported my design to GIMP, and after that using the Fab Modules, I milled my board using the different settings for the inside and outside cut. This time for the cut depth of the external path I used a deeper configuration.

More specifically, apart from the settings of the send command and the server that stay the same, the other settings change. For the internal path, I used the settings below:

  • Cut depth (mm): 0
  • Tool diameter (mm): 0.2
  • Number of offsets (-1 to fill): 4
  • Offset overlaps (%): 55
  • Respectively, the settings I used for the external path, are:

  • Cut depth (mm): 2.1
  • Tool diameter (mm): 1
  • Number of offsets (-1 to fill): 1
  • Offset overlaps (%): 50
  • Always the settings that remain the same are the Send command, which is always mod_lp.py /dev/usb/lp0 and the Server which is the ip address of the fab modules.

    The milling process this time went perfectly fine as you can see in the result below:

    As great as the above board looks, I had to mill another one as I blew up the first one. Firstly, I had created a short circuit during the soldering process of the board that I did not notice. So, in order to debug it, I tried unsoldering different parts and soldering them again as at first sight it seemed that no short circuit existed. After the bootloader was finally burnt to my board, and was ready to finish it, I made all the connections with two servos and the ftdi cable. As I opened the external battery supply, it directly gave 12V on my board without me being able to first regulate it at 5V. At that moment, the microcontroller, one of the usb hubs of my computer and the two servos, burnt. MY computer did not turn on for 2 days. No fun! So, I had to mill and solder a second board. This time, I was extra careful, checking for short circuits beforehand and I did not solder the voltage regulators as we were not sure if they were correctly connected.

    On the left you can see the first board, which is quite messy and on the right you can see the second one.

    A mistake I was making while soldering the microcontroller was to go just with the tip to the trace of the board instead of going sideways in order for it to heat better. The second board worked just fine but I tried this time only with one servo motor as I burnt the other ones and well, there was just one left.. Oops...

    Programming

    For the programming I used Arduino language. First of, I downloaded a new library and inserted to the Arduino by going to Sketch -->Include library --> add .zip library. The library I used was the VarSpeedServo that I downloaded from github.

    But before writing the program, I had to be able to make the board be programmed as a standalone board without an external programmer. To do that, I had to follow the steps below:

  • Connect the Arduino Uno to the pc.
  • Select the right port and the Arduino Uno board under tools.
  • Under >File >Examples, find and open "ArduinoISP" sketch.
  • Upload the sketch to the Arduino.
  • Disconnect the Arduino from the pc.
  • Connect the board with the Arduino following the schematic below.
  • Connect the Arduino to the pc.
  • Select the "Arduino/Genuino Uno" board and the "Arduino as ISP" programmer.
  • Click to >Tools >Burn Bootloader.
  • After the bootloader is successfully done, we connect the FTDI cable to program the modified satshakit board.
  • Now, I can program my board as a standalone. The only thing I have to be careful is to be sure that the last thing I uploaded to the board is the bootloader and nothing else.

    So, after this I procedded to write my code, which was a simple one:

     
    // including the library that I used for the servo motors
    #include <VarSpeedServo.h>
    
    // appoint a name to my servo
    VarSpeedServo servo;
    
    void setup() {
      // the pin which I attached my motor
      servo.attach(5);
    }
    
    void loop() {
      /* degrees of my servo turning, the speed and true if
      it is going to wait for the last movement to happen */
      servo.write(180, 30, true);
      servo.write(0, 40, true);
    }
                                

    Usually, before trying the final code out, I do a test of the blink code before burning and bootloader through the Arduino by uploading as a programmer and after I burnt the bootloader but before trying the final code by using the FTDI cable. If those two work fine, I feel more confident in proceeding. It works like a safety trial.

    Below you can see how the code works with two servo motors after modyfying it accordingly:

    Downloads

    Hereby, you can find the Board.sch and the Board.brd , the Inside Cut.png and the Servo code which I used.