Home Assignments Project Development Final Project About Contact

Output Devices

Assignment

  • Add an output device to a microcontroller board you've designed, and program it to do something

Files

PCB design and production

From the last week were I layed out the electronics that I needed for my final project, I figured that this week was all about making the circuit board that will control a motor which I will be using with my locking mechanism. I looked a bit into motors to figure out how I would be able to specify the actions through the code I will be making, and figured out the servo motor would be the best for my needs.

I looked at the board Niel introduced us to in his lecture and figured out I needed another version of this. His design is powering two servo motors where I will only be using a single one. Also I would like the motor board to be connected to my Raspberry Pi using the pins on the Raspberry Pi so I can send information back in forth. Therefore I decided to add a FTDI jumper. The ATtiny 44 had enough pins for this. The list of components I will be using is therefore:

  • ATTiny 44A
  • 20.0 MHz external clock
  • 10 K Resistor
  • 22 uF capacitor
  • 2x2 Jumper for power
  • 2x3 Jumper for ISP
  • 2x3 Jumper for servo
  • 5 V regulator
  • Jumper FTDI

I added these to the schematic in eagle and connected everything according to the same design rules as in week 7 about electronics design.

schematic

TWhen going from schematic to creating the actual path I tried to use the autogenerate function without setting the route settings. Unlike other times auto generating the route worked, but this was only due to settings of the route. After having set everything as in week 7, the program could no longer make a route on a one sided board. I'm not sure the settings we are using in the lab for this to work with our machine is correct since the route seems fairly big in the software compared to what the machine can actually do. Being able to auto generate would be a big improvement to the workflow.

Sadly I had to make all of the connections myself. I looked at the board Neil made with a servo motor to see how his route was. After some time playing around with it the route was ready.

route

Next I exporting the files into Inkscape where I would simply add my name to it, and make a outline from two squares. I exported these with 500 dpi and inserted them into fabmodules.

inkscape

In fabmodules I had some issues when generating calculating the traces. I would have some small shortcuts. I got rid of these by changing the tool diameter from the standard of 0.4 mm to 0.3 mm.

fabmodules

I milled the board and to my satisfaction the manipulation of the tool diameter seemed to have worked. I started to find all of the components by listing them on a piece of paper but discovered that we did not have a 22uF capacitor. The biggest we had were a 10uF capacitor. After discussing the possibilities with my instructor, I decided to use two 10uF capacitors by placing them in parallel which I will do by soldering them on top of each other.

PCB

Coding

When coding the board I figured I would make some code I could use with my locking mechanism that I made in week 6 since it is the reason why I made this PCB. Before getting into the code I had to make another version of my locking mechanism since I’m now using a servo motor instead of a DC which I made the mechanism for in the first place. The result is displayed below:

mechanism mechanism

First thing to do was to burn bootloader. I keep getting an error while doing this and tried to solve it by exchanging some of the components but without success. After some time I decided to make another PCB identical to the one I just made. With the new one I was able to burn bootloader.

I decided to go ahead and use the Arduino IDE for this task, and looked up some of there guidelines for coding with servo motors. I found some different examples and uploaded them to the microcontroller aswell as my own code and also made sure I was using the correct pin number in Arduino. When using connecting the servo motor with to the board while it was being powered from the FTDI cable, which is a 3V cable, the motor would spin for a second or two which indicates to me that it is working but it needs more power, which is also why there is a jumper made for being used with a 9V battery. But whenever I plug the battery in it will start to smoke if I dont remove it soon enough. The regulator will get very hot and there comes a small bump on it as if the regulator is about to explode.

Update

3 weeks later from the the actual output device week I finally made the servo motor work. During this time I had been doing the weekly assignments while working on solving this issue simultaneously. The error with this PCB has most likely been the pin configuration of the regulator. I have been trying to do different layouts of the traces according to he datasheet of the regulator we had in the lab, which we discovered is different from the one Neil is using is his example boards. In order to solve the problem we also ordered a regulator with the exact same pin configuration as the one Neil is using but the PCB will still not work with the servo.

datasheet pcbs

After being clueless of what to try next, my instructor stumbled across someone who made a servo work with the echo hello world boards from week 7. Since this update is written a few weeks later I had in the meantime made another version of this in week 14 about Networking and Communications, which would be ideal to use for this. This is the person who made this work, so I tried to replicate what she did, but when it came to the Arduino code It would not compile and instead call for errors. Therefore I used the c code provided from Neil which finally gave me a successful outcome. The idea behind using the echo hello world board is to use GND, VCC and MOSI, used as the servo pin, which can all be found on the ISP header and avoid using regulators since the power commming from the FTDI connection is already 5 V.

circuit

When I tried to troubleshoot all the versions of the servo PCB’s I never tried to use c code since I was under the assumption that it wasn't an issue. I therefore went back to try and upload the c code to the servo PCBs with the newly baugth regulator were I was sure the pin configuration was correct but I would always be unable to burn bootloader or after some the microcontroller would stop responding. I would have been very interested in finding out what is going on but because of I time management I decided I couldn't keep dedicating my time to it.

Even though I would have liked to make the initial servo board design work, this is also a good solution, especially if I can code the button to activate the servo when developing my final project. I does complicate things a bit that it has to be done in c code instead of using the Arduino IDE. I looked at the c code provided by Neil and figured out after some trial and error that the OCR1A value is a position for the servo to be in. I found the perfect values for my project as you will see in the video underneath.

code

Also the sketch of how I would lay the electronics for my final project which I made at the beginning of the input device week Is no longer valid anymore, but this is what happens when you get wiser.