Skip to content

Main Week

The group met in Ísafjörður Monday April 7th. We document what each team member did on the following days.

Task Assignments

Jóhannes

  • Vertical axis drive design and manufacturing
  • PCB schematic, routing
  • Creating all connection cables with connectors
  • Programming and debugging the microcontroller
  • Reverse engineering of components for 3D assembly
  • Cable routing and final assembly
  • Final iteration of arm bracket
  • Assembling of arm with sun
  • Photography and video recording of the machine

Ólöf

  • Collect components
  • Participate in designing in Schematic and PCB editor
  • Participate in milling the PCB board
  • Participate in souldering components to the PCB board
  • Burn a bootloader to the ATSAMD21E18A-A microcontroller
  • Design base/enclosure in Fusion
  • Cut out the base/enclosure in the laser cutter
  • Write a storyline for video
  • Design a title page for video
  • Line up video clips and images
  • Add text/information to video
  • Design a presentation slide

BjarturL (Landscape)

  • Make the landscape model from the heightmap
  • Make it a Circle
  • Make it Functional
  • Started 3D Printing
  • Done 3D Printing
  • Documented
  • Done.

Day 1 (Monday)

Main tasks:

  • Collect components
  • Design the PCB board
  • Finish designing the base in Fusion

Jóhannes and Ólöf searched for components that we wanted to use in our machine and collected them all in one place.

Jóhannes had created Kicad files for our board and he designed most of it. He and Ólöf cooperated on it, but it was mostly done by Jóhannes.

Jóhannes created Fusion files and added components to use in the design. He had drawn some components himself (components where no 3D CAD file could be found online). Ólöf designed the base/enclosure prior to the main week, with assistance from Jóhannes. Then she added holes for input and output on day 1 (Monday).

BjarturL

Main Tasks:

  • Download the heightmaps
  • Combine two heigtmaps in QGIS
  • Choose the Area
  • Make Isafjörður be the center

Today, I started redoing the model. The previous version looked fine and would have worked, but we would have needed to drill holes into it. So, we decided I would remake the model and, in the process, ensure that Ísafjörður was in the center. To achieve this, I needed to combine two heightmaps. First, I downloaded the two maps and imported them into QGIS. Next, I used Claude to generate a script in QGIS to combine the two maps. Here is the script:

from qgis.core import (
    QgsRasterLayer,
    QgsRasterBandStats,
    QgsRasterDataProvider,
    QgsProject
)

from qgis.analysis import (
    QgsRasterCalculator,
    QgsRasterCalculatorEntry
)

# === Input paths ===
input_raster_a = r"C:\Users\Bjart\Documents\QGIS_ISA\1.tif"
input_raster_b = r"C:\Users\Bjart\Documents\QGIS_ISA\2.tif"
output_raster_a = r"C:\Users\Bjart\Documents\QGIS_ISA\1a.tif"
output_raster_b = r"C:\Users\Bjart\Documents\QGIS_ISA\2a.tif"

# === Load rasters ===
layer_a = QgsRasterLayer(input_raster_a, "RasterA")
layer_b = QgsRasterLayer(input_raster_b, "RasterB")

if not layer_a.isValid() or not layer_b.isValid():
    raise Exception("One or both rasters could not be loaded.")

# === Get stats ===
def get_min_max(layer):
    provider = layer.dataProvider()
    stats = provider.bandStatistics(1, QgsRasterBandStats.All)
    return stats.minimumValue, stats.maximumValue

min_a, max_a = get_min_max(layer_a)
min_b, max_b = get_min_max(layer_b)

# === Global min/max ===
global_min = min(min_a, min_b)
global_max = max(max_a, max_b)

# === Create raster calculator entries ===
def create_entry(layer, name="raster"):
    entry = QgsRasterCalculatorEntry()
    entry.ref = f"{name}@1"
    entry.raster = layer
    entry.bandNumber = 1
    return entry

entry_a = create_entry(layer_a, "RasterA")
entry_b = create_entry(layer_b, "RasterB")

# === Normalize Raster A ===
expression_a = f"(\"RasterA@1\" - {global_min}) / ({global_max} - {global_min})"
calc_a = QgsRasterCalculator(
    expression_a,
    output_raster_a,
    "GTiff",
    layer_a.extent(),
    layer_a.width(),
    layer_a.height(),
    [entry_a]
)
result_a = calc_a.processCalculation()
if result_a != 0:
    raise Exception(f"Normalization of Raster A failed with code {result_a}")

# === Normalize Raster B ===
expression_b = f"(\"RasterB@1\" - {global_min}) / ({global_max} - {global_min})"
calc_b = QgsRasterCalculator(
    expression_b,
    output_raster_b,
    "GTiff",
    layer_b.extent(),
    layer_b.width(),
    layer_b.height(),
    [entry_b]
)
result_b = calc_b.processCalculation()
if result_b != 0:
    raise Exception(f"Normalization of Raster B failed with code {result_b}")

print("Global normalization complete!")

Then I reimported them, and now I had two heightmaps that matched each other. The rest was quite simple. I followed the instructions from the preparation page, and then I had a model of Ísafjörður.

Day 2 (Tuesday)

Main tasks:

  • finish drawings of all purchased components in Fusion
  • 3D print dial knobs
  • finish KiCAD schematic
  • make PCB routing and production files
  • Mill the PCB board
  • Solder on the PCB board
  • Design the top on the base and the holes for components

Ólöf designed the top of the base and then she drew holes for components. This was all done with assistance from Jóhannes.

Jóhannes finished the schematic drawing in KiCAD for the PCB that includes all the peripherals and components for our machine. This is a screenshot of the drawing.

Then he made the routing of the PCB traces and finished the design. First we ran into trouble because Ólöf and Jóhannes were trying to cooperate on a shared KiCAD drawing in Git. Because we weren't using the same version of KiCAD and not exactly the same library version, we had some issues to get it working.

The next issue was, that when updating the PCB from schematic only some few ratnest, but no footprints appeared. The issue was, that almost all objects were hidden for some unknown reason. See the screenshot below:

After having fixed that issue, the tracing was pretty straight forward, but we had to use some bridges and rearrange some pins for convenience.

Here is the result in KiCAD:

And here are the design files:

Board1-traces

Board1-outlines

Here you can see what the board looked like after milling:

Board milled

Jóhannes designed knobs. Here is one printed knob in front of the Fusion drawing on the screen. He printed four knobs in total (one spare).

Knobs

Ólöf and Jóhannes milled the PCB board in the Roland Modela Mdx-20. We are using the ATSAMD21E18A-A microcontroller and the traces are very thin. Jóhannes had to tune the size of the pads down in the footprint editor and we had to adjust the settings before milling because it seemed as if the machine would not mill everything it should (some diagonal paths).

On this image you can see Jóhannes pointing where there should be paths to be milled, but they were missing.

Paths missing

This was fixed by telling Fab Modules that we were using smaller endmill than we were actually using. Then the program created all paths we were hoping for.

After this Jóhannes and Ólöf participated in souldering the board. Jóhannes did most of it, f.ex. the supertiny traces around the microcontroller.

BjarturL

Main Tasks:

  • Finish the model
  • Make it into a circle
  • Started 3D printing

Today, I finished the model. I used Blender with a boolean modifier to shape it into a circle and added the necessary holes for the magnet and the motor connection. Then, I prepared the model for printing in PrusaSlicer and started printing it on the Ender 3.

Day 3 (Wednesday)

Main tasks:

  • Print the components for the vertical axis drive
  • Solder/Connect a USB-C to the PCB board
  • Burn a bootloader to the PCB board
  • Debug PCB board
  • Add holes on the enclosure for input and output
  • Add components to the enclosure
  • Design text and images on base

Today Jóhannes printed the components for the vertical axis drive and now this subassembly is finished.

The fit for the bearings was very good and everything fit, except for the bearing seat in the upper flange. There was a small mistake in the design and the seat was too shallow.

We could have printed a new upper flange, which takes about 4,5 h, but instead Jóhannes decided to try and fix the seat in the lathe. Because it is a very small lathe, the chuck couldn't hold the hexagon on the outside. He had to make a small adaptor plate and hold the flange by mounting it with screws to the adptor plate. That was easy and took about 30 min.

After lunch it was time to assemble the drive.

Here Jóhannes glued the Hall effect breakout board in place:

And here is what the other side looks like (with a HX-711 motor driver):

Gear printing

Spur gears with M 0,6 seem to be close to the lower limit of what a regular FDM printer with 0,4 mm nozzle can achieve.

Ólöf burned the bootloader to the microcontroller. Svavar Konráðsson showed how to use a bootloader for the ATSAMD21E18A-A, following the directions from here, which led us to this site about the Programmer SWD D11C here and to Arduino Sam tutorial here.

In the image below you can see how the main PCB board and the D11C-based programmer with SWD connector are connected in the process. Ólöf's first attempt did not work but Bjartur noticed that she had not chosen programmer in the process. When the programmer had been chosen, the bootloader was burned.

Burning in progress

In the image below you can see written that the bootloader has been burned:

Bootloader has been burned

The next step was to program the microcomputer, but it did not respond as it should. Jóhannes tried to debug the board, but the debugging did not go well. We weren't able to get the I2C channel to work and had other intermitted issues with the board (not recognized as serial device, no response on serial monitor). Unfortunately, the only logic analyzer that we have in our Lab was not available during the whole machine week, because one of our instructors took it with him to a business trip. We made some modifications and tried to get help, but nothing seemed to solve the issues for us. We even tried replacing the microcontroller.

The later half of the day went into troubleshooting the USB connection and serial communication.

At one point we could program the board via SWD and receive an output on the serial monitor, but after that everything seemed to get worse. Our supervisor tried to assist, but in the end we had to give up - quite frustrated.

The status by the end of the day is a board that:

  • isn't recognized as USB-device
  • doesn't send any thing via USB
  • seems to be still programmable via SWD

Gear printing

During the troubleshooting we found two potential issues, that we could fix by adding jumper wires and a capacitor for noise reduction close to the SAMD21 voltage supply. Will it help?

While others were working on debugging, Ólöf finished adding holes in right sizes for each input and output. Then she added components to the surface of the enclosure in Fusion; LCD screen, buttons and switches.

BjarturL

Main tasks

  • Document
  • Fab Academy Meeting

Today was the Fab Academy meeting so that took up most of the day. So the main thing i did today was document.

Day 4 (Thursday)

Main tasks:

  • Continue debugging PCB board
  • Finish design of enclosure
  • Laser cut and rasterize enclosure

This day started with continuing issues with USB and serial communication. When Jóhannes had tried sending the program to a development board and even the development board stopped responding, he started suspecting the code to be the issue.

That turned out to be right. He excluded the libaries from the code and now things started working. He started going through the peripherals testing them step by step:

  • the potentiometers
  • the end-switch and set-switch
  • the motor drivers

The LCD display didn't work so he started looking at the SERCOM functions of the SAMD21 and how to define the right pins for I2C.

He found a page here that explains it, but struggled to understand the instructions.

However, even with trying all the possibilities and adjusting different setting we weren't able to get the I2C to work.

By the end of the day we started considering and discussing possibilites of using different microcontrollers and had several options, but eventually could narrow it down to one (possibly) feasable option that would be the AVR128DB32.

Our instructor Svavar started designing a breakout board for this microcontroller, while Jóhannes looked at the cutting files of the enclosure and made some fixes.

Ólöf used this day to finish adding information and decorations to the enclosure. She finds the math and programming behind the function of this machine so amazing and she wanted what was going on to appear on the surface of the enclosure. She designed one side with the formulas for calculating the zenith and azimuth angle of the sun and added an explanatory image of it.

On another side input and output were written. Ólöf made a pen drawing of the mountains that the sun hides behind, traced the drawing in Inkscape and used it on two sides of the enclosure.

Then Bjartur suggested that we would add a map of the Westfjords in Iceland and Jóhannes suggested that a pin would be added to the map, to show where Ísafjörður is.

We wrote the names of the group members and wrote Fab Lab Ísafjörður, where we realized this machine.

Links to images and information on enclosure

Here are links to all information and images used to decorate the enclosure:

Link to solar azimuth angle formula and calculator here. The formula was used on the design of the enclosure.

Link to solar zenith angle formula and calculator here. The formula was used on the design of the enclosure.

Link to explanatory image of zenith and azimuth angle used on enclosure here

Link to map of Westfjords here. The image was used on the design of the enclosure.

Ólöf had little time left to finish lasercutting the base, before leaving Ísafjörður and the last steps were taken in too much hurry. She made mistakes and had to leave before the lasercutting was done. Jóhannes finished the job the day after, when mistakes had been fixed. The top of the enclosure appeared as three lines in Inkscape when it was imported from a DXF file. Maybe this happened because the file was imported more than once. This meant that the laser did the cutting three times and it ruined the piece. Ólöf had also not noticed that the design was so big that she should have been more careful when setting the homepoint, so the design went a bit out of the boarders of the MDF plate.

When Ólöf used the Combine with the Cut command under it in Fusion, to make the tabs on the top create slots in the sides, it did not work as it should, resaulting in a straight line at the top of two sides instead of a side with fingers. This would probably not have happened if she had turned off sketches when combingin/cutting.

Then she exported a DXF for two sides with holes in it, but the holes were not in the DXF. That would probably not have happened if she had turned off other sketches than what she planned on using.

Jóhannes and Ólöf fixed these mistakes and Jóhannes finished lasercutting the rest.

Day 5 (Friday)

Jóhannes finished lasercutting what was left of the enclosure. Then he assembled the front panel + back panel and added rubber feet to the bottom.

This morning we made a Rev B version of our board and tried some tips from our instructor and from the mattermost chat, but nothing got the I2C to work. We discussed other solutions, but because of the limited number of pins available, we were quite restricted to I2C and we need a display for our machine.

Because the I2C pins of our board were accidentally damaged and we were still hoping to get it running with the help from Mattermost and our instructors, Jóhannes made a new board, with some improvements as two 4,9k pulldown resistors to SDA and SCL (as by recommendation of our instructor).

Then we did some more testing and debugging, but without any major success. We tried defining the pins Wire.begin(8,9) and tried the Softwire.h library as well.

Below is an image of the different boards we tried (after desoldering some components we reused).

During lunchtime we tested a development board with AVR128DB32 chip and it worked with the I2C display. Therefore, we decided to redesign the PCB and produce it with the new architecture. Jóhannes did the redesign and production of the new board. It took two attempts to mill it, because there was a dull bit in the machine when it was milled the first time. The second attempt went well. This was ready in the evening and finally something started to work.

Below is a screenshot of the new PCB.

And here are the design files:

Board2 - traces and drill

The next step was to solder and program the new PCB and what a relief when the screen and some other peripherals worked finally!

We used the DXdCore for determining the pinout.

Jóhannes used the rest of the day to develop different loops of the program and testing and debugging the inputs and outputs.

Ólöf used this day to search for and try out a Video editor. She began with Movavi.

Free edition of Movavi

She took some clips and created a short video with them. The Movavi app works well but the watermark in the free edition is quite big. This was a good practice and it gave some idea on which shots we would want to use in the final video.

Watermark on Movavi

Day 6 (Saturday)

Ólöf used this day to write a storyline for the video. Then she designed a title slide for the beginning of the video. This design was done in Canva.

Jóhannes spent most of this day programming and testing our new PCB, looking into the settings and properties of the AVR128DB32 microcontroller. He wrote a program for homing procedure for the azimuth axis. Then he tested it and debugged it.

Then he made improvements to the display and interface and tested all switches and the adjustment knobs.

Up unto this point he had been running the machine on USB power and had not connected the LED either.

Machine not working properly

When he connected it to 12V DC he realized that the machine wasn't working properly on it. The motor was quite weak and had issues turning the model. Additionally, the display was very faint.

He found out that the voltage regulator he used in the schematic was from the list of the Fab Inventory (NCV1117ST50T3G) and the one he used was marked "5V 1A voltage regulator" and had the same footprint, but was a different type and had not the same pinout!

He had to solder new voltage regulators to the board and fix the board with some jumper wires, but still the problem persisted.

He decided to take a break from trying to solve the voltage regulator issue until the next day. Instead he continued looking at the PWM control for the light, which had issues. It was constantly on, but the brightness changed a little when adjusting the PWM output.

After some research he found out that the high-side switching with a P-Mosfet isn't a good idea, when the logic voltage and the source voltage aren't the same. This was however what he had drawn in the schematic.

The solution to this was to change the circuit to a low-side swithcing N-Mosfet.

After drawing the changes in KiCad he tweaked the traces and was to rerout the 5V and GND and accomodate the N-Mosfet in a suitable location.

With these changes the light could be adjusted using the `analogWrite(pin,pwm); command.

Jóhannes also added a small pin to the landscape model to point out where our Lab is located exactly.

Day 7 (Sunday)

Ólöf used the time she had this day to document and add files to the repository.

At this point there were still problems with the board. The P-Mosfet track was transmitting 3.3V to the light, both when the PWM was turned on and off. Jóhannes was able to fix the P-Mosfet track by changing it to N-Mosfet. He also changed the numbers of voltage regulators from 2 to 1.

For some reason the voltage regulator was only giving 4.5V instead of 5V, which was not enough to drive the motors and the LCD screen. Jóhannes looked into this with Svavar. It seemed as if the diode was causing a huge voltage drop when power was forwarded through her. Jóhannes switched the diode with a Schottky diode but there was only a small change. Jóhannes learned, that there are special IC circuits, that work like an ideal diode and should be used for applications like this, but unfortunately this wasn't available in our Lab.

The next solution that Jóhannes tried out was to use a small SMD slide switch instead of a diode but unfortunately this switch could only handle 100 mA and that was far from being enough.

The next attempt was to use a 2-pin socket header with a jumper wire between. This solution worked very well! The voltage kept stability and there was no faint in the display. Well, no faint until the motors were used. The voltage regulators, that were fed with12V, began heating up and the copper traced could not dissipate the heat. By protection mechanism it started reducing the output power. Jóhannes could not find a suitable heat sink but he realized that he could run the motors of a powerful USB power supply. He decided to move the voltage regulator from the board and make a power cable with a barrel jack and a USB connector. This solution worked.

After solving these problems he organized the cables and placed the PCB along with the motor drives inside the enclosure and connected the power with other cables. The red tape indicates the orientation of the connectors.

This video shows the homing procedure after turning on the machine and selecting the date and time. Then the model moves to the right azimuth.

Day 8 (Monday)

Ólöf kept on documenting.

Jóhannes took the landscape model and painted the sea blue.

Note

Jóhannes used water based acrylic paint and painted directly on the PLA

The picture shows how our artificial sun is casting shadows on the newly painted landscape model.

Day 9 (Tuesday)

Day 10 (Wednesday)

Files

Fusion files

Side dxf

Back with holes -dxf

Bottom dxf

Back with holes 1 dxf

Fixed back with hole for arm dxf

Fixed back with holes for USB-C, power and switch dxf

Files with faults in them

In the Back Left dxf file the mistake was probably that a wrong plane was chosen when projecting the sketch:

Back Left dxf

In these files the top side was straight where there should be fingers:

Backside with hole for arm dxf

Back side dxf

Too many lines and export too big

This final file gets extra explanations. When the top was exported as a dxf file and imported into Inkscape, the outlines were exported as three lines! The inner lines were exported as two lines. You can see this in the image below where the lines were dragged to each side.

Notice one more thing; When we were fixing the mistakes that were made when producing the parts of the enclosure, suddenly all sizes changed. This happened in Ólöf's computer and the reason is most likely some settings that she accidently changed. She hasn't found the reason but will probably find out what happened. For this reason components that were exported from Fusion and imported from dxf to Inkscape appeared far too big in Inkscape. F.ex. the width of this top should have been around 340mm but suddenly it is imported as 16.600mm.

Triple lines when imported in Inkscape

The dxf file:

Top dxf

The Inkscape file:

Top with triple lines and too big

Inkscape files

Bottom and backside svg

Bottom and back pdf

Front and top svg

Front and top pdf

One side with names svg

One side pdf

Sides svg

Sides pdf

Position pin svg

Position pin pdf