Skip to content

Development of the final project

The idea

I live in a small town in the east of Iceland, Neskaupstaður. The town is in a fjord called Norðfjörður. We are surrounded by tall mountains and the sea is so close. Sometimes whales, small and big, appear above the surface and I am so faccinated by the thought about everything that is hidden under the surface.

I find the Humpback whale very interesting. It is beautiful and playful animal. It can be found all around Iceland. Fortunately, this is not an endangered species. It is common for the Humpback whale to travel all the way to the Caribbean ocean and back to Iceland during their seasonal migration. You can read about a research on it here.

MapOfHumpbackTravelingRoutes

Map of Humpback's traveling routes. Mackay, 2015.

What will the final project look like?

In Week 02 I developed the idea and here you can see what it could possibly look like:

FinalProject

As you can see, the idea is to 3D print a model of a whale and make it hover over a map. To be able to let it float in the air I wanted to use a levitation module that uses magnetic force to let a float hover in the air. Then I would design the model in a way that the float would stay inside the model. I would rasterize the map on to a plexiglass plate and maybe mould and cast a small replica of Iceland, where I live. Then I would use LED that would light up one by one to show the traveling route of the whale.

I have worked as an art teacher in an elementary school for many years and I have also taught other subjects like nature science and math. As a part of the team of teachers in elementary schools in Iceland, we were often encouraged to work with STEM, which is an acronym and it combines the subjects of Science, Technology, Engineering and Math. When the A is added to STEAM, Arts are included. Since I love working with Art and my impression is that when you combine Art with other subjects, it can spark interest and creativity with students and magic can happen.

This project can be used in STEM or STEAM education to spark students interest in many fields. By what I have experienced when teaching, just by catching the students attention with something that inspires them, it can create an interest in them that can make them want to learn and experiment. I think it can be used when teaching elementary students and even older students in highschool.

It can also be for people who want to visualize, and in a certain way connect themselves to an animal or species. It should also be an reminder that we, the human kind, should respect and care for our nature and the living beings that share it with us.

Levitation

As I mentioned in Week 01, I saw a levitation model used in the final project called Cloudio in Fab Academy by Wim Lance and it made me want to use levitation.

My instructor, Svavar Konráðsson sent me a link to this video. Here it is explained how the levitation module works, where it can be bought (Bambu Lab) and how to make 3D printed models levitate. it also has links to other information on using a levitation module with different types of 3D models. In the video it is also shown how a 3D module can be balanced with steel balls that Bambu Lab suggests using when it is difficult to balance models.

This video gave me important information because in the beginning I was worried that it might be hard to find the right balancing point. I bought the levitation module before Fab Academy began and tested it. When trying it out I found that when I didn't find the right balance everything collapsed. Since I want to 3D print a whale, which is very irregular in shape, I might have problems with balancing it right. Maybe it might be a good idea to make room for steel balls to be able to balance it if necessary.

Here you can see information about the levitation model and how it works. I bought my levitation model Here.

Tracking of whales

I contacted the Marine and freshwater research institute in Iceland and they were so kind to send me GPS information on the travels of Humpback whale and a Mink whale. I was surprised to see that the paths didn't show their travels further south, but I was told that the batteries run out. After the batteries run out the whales can be identified by taking photos of their tail and over 1000 individual Humpback whales have been identified, as you can read about here. I find that very interesting.

On this Tracking map for whales - website you can see the tracking routes map that the the Marine and freshwater research institute sent me. It is the North Atlantic Marine Mammal Commision, or NAMMCO, that does these researches on the Humpback whale. You can read more about them here.

When I looked at information on Mink whales, I started to think about changing from Humpback whale to Mink whale, because I like the too, but I have to make a decision soon. Updated: I have decided to go on with the Humpback whale.

HumpbackwhaleTravels Travels of Humpback whales, Marine and freshwater research institute, 2025.

MinkWhaleTravels Travels of a Mink whale, Marine and freshwater research institute, 2025.

Videos of mini model of final project

In week 05 I made a mini model of the whale, in week 2 i made a mini model of the box and the plexiglass map (in blue and matt clear).

Video of the mini whale model that was 3D printed

Here you can see the 3D model that I printed in Bambu Lab X1 Carbon. With the model I was trying to visualize what the final model should look like. If the whale is supposed to hover in the air with the help of magnetic force, the levitation module will be placed in a base and the float has to be placed inside the 3D model. The float is round and flat, so the bottom part of the ocean in the 3D model, should contain the float. I think I made the sea too tall because if the model is too tall it might be hard to balance it. In the final model I need to create space outside and around the float so that I can add steel balls or something alike in the right places to balance it. P.s. In the background you can see the fjord where I live; Norðfjörður. We often see whales appear in our fjord.

Mini whale model that I 3D printed

Video of the mini model

This video shows a mini version of the base, the whale and the plexiglass map.

Mini model of the final project

System integration

System integration

Read about the system integration in week 16.

Spiral development

Spiral development

In the student bootcamp Miriam Choi talked about spiral development and explained how the idea should be developed from a basic idea and then add details and further development one step at a time. This image from the slides explaines it visually. Rico Kanthatham created this image:

Spiral Development by Rico

Spiral development - main tasks

I used spiral development when working on my final project. Here below is the whole story of how each task was solved.

The enclosure (base)

Designing in Fusion

Learning how to design in Fusion

I used Fusion to design the base. Learning how to use Fusion has been difficult but I have enjoyed learning everything and designing in it. I made a mini model for the enclosure/base in week 2. Svavar Konráðsson and Jón Þór Sigurðsson taught me a lot about drawing in Fusion in week 7.

I learned so much from Jóhannes Andrésson in machine week on how to design in Fusion and that helped me so much when designin the enclosure/base.

Beginning of enclosure/base

I began by drawing a rectangle. Then I clicked on Extrude. Then I clicked on Shell and made the shell 10mm (the image shows 8mm but it ended up being 12mm).

Shelves for plexiglass

Cut for upper plexiglass

I created a new sketch on top of the base. Then I used the Extrude and the Cut option to create the shelf for the upper plexiglass. Then I did exactly the same to create another shelf for the lower plexiglass.

Creating a hole with frame for button

Hole for button

I made this sketch on the inside wall and used Extrude and the Cut option to create the hole. Then I extruded the frame around the hole to keep the silicone button in place. In the image you can see two rectangles above and below the frame. These were extruded to create shelves, which were the beginning of creating brackets.

Creating brackets

Brackets

Then I created sketches on top and under the shelves (beginning of brackets) and extruded them.

Circular pattern used to distribute brackets

Circular pattern for brackets

When you click on Create, Pattern and then Circular pattern you can distribute components around certain axis. Here I chose the Y-axis and distributed it four times. You can see that if you don't want all the components you can use the checkmark to remove some of them.

Circular pattern for brackets

Here you can see what the brackets look like in Fusion.

Step file with microcontroller from Kicad used in Fusion

Step file for Raspberry Pi Pico W

When I designed the PCB for the Raspberry Pi Pico W, as I describe here, I could export it as a .step file from Kicad. Then I imported the .step file into Fusion.

Importing step files

By clicking on the nine points at the top I opened the side view for files. There I clicked on Upload and uploaded the .step file. Then I dragged it into the design. After that I had to choose a place for it and then click Ok.

Joining step file models and model in right places

Using joint

To get the component in the right place, you click on Assemble and then Joint.

Joining

Then you click on the spot on the component and the spot on the model where you want these two to be joined.

Breaking into pieces

As you can see in the image below, when I tried to move the .step model into place, the microcontroller was left behind. I asked Jóhannes Andrésson why this happened and he told me that before joining you would have to right-click on the step model in the tree on the left and choose Rigid model. Then all elements in it will be grouped and stay toggether when moved.

Using a step file model to add same size holes

Step file models used to determine sizes and create holes

When I had exported the step file from Kicad and imported it into the Fusion file, I could see what fitted and what needed adjustment. The PCB for the Raspberry Pi Pico was too big for the design and I saw that I needed to change the brackets. When I had placed the PCBs in the right places I could choose a part of it, the holes, and project it by first creating a new sketch, then use Create, and Project/Include and then Project. Then I chose the lines that I wanted to project.

Changing the appearance of different materials

Appearance

I had to ask Jóhannes Andrésson how to change the appearance of components. Under Utilities you can choose Manage materials. Then you can choose material and then add them to favourites.

Editing colour and appearance

After adding the material to favourites you can change the appearance, f.ex. the colour. To apply the appearance to a component in your design you right-click on the component in the tree and then click on Appearance. Then you drag the material you want onto the component in the tree.

Poles with heat inserts for support

Poles for heat inserts

I created a new sketch on the bottom. I drew a rectangle and on each corner of it, I drew a circle. Then I extruded the poles.

Plexiglass window used to hide Doppler radar

Plexiglass window

I drew a rectangle on the outside of the box and used Extrude and the Cut option to create a hole for the Doppler radar. Then I drew a frame on the inside and extruded it to create a frame to hold the plexiglass window in place.

Fasteners to hold power cable in place

Holding power cable in place

I wanted to hold the power cable from the magnetic levitation module and the usb cord from the Raspberry Pi Pico W in place. I drew the blue area that you can see in the image below on a sketch that I made on the surface. Then I extruded these areas.

The almost final model in Fusion

I thought this would be the final model but then I saw that I had not given the USB cable enough space.

Walls to keep cables in place

I moved the brackets for the PCB with the microcontroller and added walls to keep the power cables in place.

Many mistakes

First enclosure printed and it was not good

In the image below you can see the enclosure that I made in spiral 1 3D printed. You can see how I used the tree support.

Failures

After 3D printing the enclosure I saw many failures. The walls that were meant to keep the power cables in place were not fitting. The holes that I created in the brackets and planned to put screws in were not good, because there was not enough space to add nuts. Also, there was not enough space for the Neopixels and the PCB on the lower plexiglass plate, so that the upper plexiglass did not sit on the shelf.

I had designed brackets for the PCBs to slide in, but it was very hard to slide all three in their place. I had to find another way to keep the PCB with the Rapsberry Pi Pico in place.

The space under the brackets was little and it was hard to remove support from there. This space was not useful, so I wanted to remove it. I kept on changing the enclosure and you can see the model here:

Changes in enclosure

Changes that needed to be done

There were a few things that needed to be changed in this model. After testing the model in the System integration week, I saw that to keep a short distance between the magnetic levitation module and the magnetic float, the columns under the module were far too high and they could not be smaller unless I changed the height of the enclosure.

Svavar Konráðsson also told me that by using a 5V, 3A Step-Up/Step-Down Voltage Regulator S13V30F5 I could use one cord to power both the magnetic levitation model and all the electronics with the microcontroller. This means that I only need one hole for power input.

Changes led to warnings

I tried to make the model smaller by reducing the height of it and get rid of the small, empty space under the brackets. When I did that, almost everything turned yellow or red with warnings, as you can see in the image below. I tried to make changes and go backwards but that did not go well.

Another way to make changes

After quite some time of trying, I decided to use another method to make changes. I clicked on Inspect and then Section analyzis. Then I chose which plane I wanted to start on and used the arrow to drag where I wanted the cross section to be. Then I measured how much I would have to extrude the brackets to fill the empty space.

More space for Neopixel PCB/plexiglass

I extruded the top brim and then I extruded the shelf to create more space for the plexiglass plate with the Neopixel PCB.

More space for wires

I used the Extrusion and Cut option to shorten the lower brackets where I needed more space for wires. This is the corner where the wires from the Raspberry Pi Pico connect to the voltage regulator.

Fasteners for power cord

I created a new sketch on the bottom and drew two rectangles. Then I extruded them. The next step was to create a new sketch on the side of these cubes and draw a rectangle and a circle.

Midpoint used to place circle

I drew a line in the middle of the cube and used the Midpoint option under Constraints to place the circle in the middle.

Cut

Then I used the Extrusion and Cut option to create a hole. Now I had created two fasteners for the power cord. The cord should be able to slide in and stay in place.

Move

Then I saw that I had to move one of the fasteners. I right-clicked on the screen and chose Move/copy.

Soft corners

Finally, I added fillet to the corners of the fasteners.

Inner walls

Inner wall created

I wanted to make the system integration and packaging better. I decided to design inner walls that slide down into the slots beside the PCBs and hold them in place. These walls also protect the wires.

I created a new sketch on front of the brackets and drew a rectangle beside the brackets. This was the beginning of the first inner wall. Then I extruded the wall until it was the same thickness as the brackets.

Wall extruded

I clicked on the side of the wall and also on the side of the bracket and extruded it. In the image it looks as if it was extruded it all the way to the left side but there was a small space for wires.

Wall hidden

It is possible to hide components by clicking on the eye in front of them in the tree. This is useful when you can't see the area you are drawing in. I hid the wall and drew a fastener that fitted into the slot.

Fastener extruded to join the wall

Then I drew a rectangle at the top of the front side and extruded it until it could join the wall.

Top closed

I made a new sketch on the backside of the wall and drew a rectangle on it. Then I extruded it until it closed the gap above.

Three inner walls

I made two more walls the same way.

Walls cover PCBs

Then I decided to let the walls also cover the PCBs, so I extruded the side of the walls until they covered the PCBs.

Cover over voltage regulator

I added a cover over the voltage regulator by extruding two rectangles from the wall.

Sockets for heat inserts

Sockets

I was worried that I might ruin the enclosure if the heat inserts would not melt into the poles the right way. Svavar Konráðsson suggested that I could use sockets and I thought that it would be a sensible way to solve this.

Then I made the original poles on the bottom of the enclosure shorter and created a new sketch to extrude hollow poles around them. Then I added a new sketch on top of them and extruded massive poles.

small holes for heat inserts

The heat inserts have to melt into the poles but I was worried that it would not be easy. I decided to create small holes, hoping that they would guide the heat inserts the right way and still have enough material for the heat inserts to melt the pla so that they would be well fastened.

Another positive thing about using poles with sockets for fastening the magnetic levitation module is that if I have to remove the module it would be easy to lift them off.

Final enclosure/base

Final enclosure

Here you can see the final enclosure. I added walls inside to hide wires and cover the voltage regulator. I also added fasteners for the power cord. The inner walls are slided down over the lower bracket and can be lifted easily off. They also stop the PCBs from moving around. You can find the model under files.

3D printing enclosure/base, inner walls and poles

Printer and nozzle

Printer and nozzle

I used the Bambu Lab X1 Carbon to 3D print. I used a 0.4 nozzle,

Settings for support

I used 30° when generating support for the enclosure, inner walls and poles.

Settings for speed

You can see the settings for speed in the image below.

Settings for strength

Here you can see the settings for the strength.

Settings for quality

Here you can see the settings for quality.

Material

I used blue Greentech pro PLA filament for everything. I used blue for the enclosure/base and grey for the whale model and the socket under it.

Enclosure around magnetic float

Directions

Directions

I followed this video called How I Designed A Simple Threaded Container With Autodesk Fusion 360 to design an enclosure around the magnetic float.

I also foun directions with video called How To Create Threads in Autodesk Fusion - 2024 Update.

Circle with offset

I began by drawing a circle. Note that in this image the circle is 62mm but I ended up by making it 85mm. Then I clicked on Modify and Offset. The offset was set to -4.

Extrusion

I extruded the bottom (inner circle) for 5mm and then the outer circle for 20mm.

Adding thread for screwing parts toghether

Thread added

I clicked on Create and Thread. Here you can see the settings I used. I had to use offset to place the thread at the top. I was not using the same size as in the video so I was not sure if I would do this the right way, but I hoped so.

Fillet

I added a fillet to the bottom.

The upper half

I designed the upper half the same way as the lower half but added an inner wall.

A spacer

I added a spacer by drawing two lines between the walls and extrude the space between them.

Circular pattern

Then I clicked on Create, Pattern and then circular pattern. Then I chose the spacer as an object, chose the z-axis and created 12 spacers.

Fillet

I only added a fillet in the middle where I would place the magnetic float.

Create thread

Then I clicked on Create and Thread. In the image below you can see the settings that I used.

Socket on top of enclosure for float for whale model

Then I created a new sketch on top of the enclosure, drew two circles and extruded them to make a socket for the whale model.

Failures with thread

Not fitting well

When I tried to assemble these two parts they did not fit well toghether. I added fillets and printed it again but that did not help enough. I changed the thread and unfortunately the thread became too rough and there were holes in the model.

Socket on top of enclosure for float for whale model

Then I tried to make the enclosure smaller and I made many edges softer. I could not close it all the way, only a little bit. Then when I tried to use it on the final project, it did not float in the air. It only sat on top of the plexiglass plate.

Socket instead of enclosure

Socket on top of enclosure for float for whale model

Then I decided to skip the lower part and only use a socket that sits on top of the magnetic float. That worked very well! Here below you can see the whale model in the socket and the magnetic float beside it.

Enclosure for float 3D printed

Printer and nozzle

I used the Bambu Lab X1 Carbon with a 0.4 nozzle.

Material

I used Greentech pro PLA filament.

Settings and material

I used the same material and the same setting when 3D printing the enclosure for the float and the whale model, for speed, quality and strength.

Plexiglass map and plexiglass PCB

Plexiglass for Neopixels and plexiglass at the top

I used this map when I made the plexiglass map at the top of the enclosure. This is a screenshot of it.

Map with cutting lines

I imported the image into Inkscape. I clicked on Path and then Trace bitmap. Then I clicked on Apply. After that I deleted the original image. I clicked on Object and Fill and stroke. I turned the Fill on and set the colour to black. Then I turned the Stroke paint off. This way the black areas were rasterized and not cut.

Then I used the rectangle tool and drew a rectangle and softened it's corners.

The whale model

The basic form

In the beginning I tried to create the basic form of the whale. I experimented with this both in Blender and by modelling it out of clay and then 3D scanning it.

Designing a whale in Blender

Blender

When designing the whale in Blender in week 02, I have been using three images as a reference:

  • This image from ABC News supplied by ORRCA member, Wayne Reynolds.

  • This image taken by photographer David Edgar and appeared on his Instagram account.

  • This image taken by photographer David Edgar and appeared at Daily Mail.

  • This image by Jón Baldur Hlíðberg. He is an amazing icelandic artist who has done many artworks from icelandic nature, both animals and plants. I searched for his phone number, contacted him and asked if I was allowed to use his artwork as a reference and he approved.

Modelling a whale out of clay and 3D scan it

Whale modelled out of clay and then 3D scanned.

When I modeled the mini whale out of clay in week 05 I did a Google image search and used the overall results with many images when I modelled the whale. Here is a link to the Google search results.

Second attempt at drawing a whale in Blender

Drawing in Blender

I decided to give Blender a second chance after awful results in drawing a whale in week 02. This was done in week 15, but document it all here, so there is no link to it.

I used this video to begin with. It shows how to draw a great white shark, but I like the way he explains things. This is what I did when following the instructions.

In the video the default cube was deleted, so I began by doing that. Then I split the screen into two screens by moving my mouse up to the right corner of the screen until it showed a cross cursor. Then I dragged the splitting line over to the middle and then I had two seperate screens. After that I chose which view I wanted in each screen and this image from the video shows which views are chosen:

Here you can see what my screen looked like and how I chose the right view. I used the front view in the left window and the right view in the right window. Then I added one more as seen from the bottom. My numpads were not working as in the video, so this is how I chose the view:

Choosing views

To add a reference image I pressed on Shift and A. Then I chose Image and then Reference. Then I could add an image to use as a reference in Blender.

Image reference

Name the reference and use opacity

I named the reference image as Front.

I clicked on the image symbol (Data) down on the right and checked in the box marked Opacity.

I added three images in total as references.

Shortcuts in Blender

A few shortcuts in Blender that I learned about in week 02:

Shortcuts in Blender

Here is a list of shortcuts in Blender.

If you have an active keyboard:

By hitting the number 1 on your keyboard you get the front orthographic view. Nr. 3 takes you to the right orthographic view or side view.

SHIFT+D = Duplicate SHIFT+A = Opens up list of actions, f.ex. if you want to select an image and then click on Reference.

If you want commands to happen on a specific axis, x-, y- or z-axis, then you can hit the button with the first letter in the command and then write x, y or z after that. This way you can f.ex. hit the letter S (scaling) and then right after that, the letter Y. Then you can scale the object along the y-axis.

Hitting G and then x means that you can move it on the x-axis. Choosing E and then Y is for extruding on the y-axis. Use the R-key to rotate a line, plane or point.

I used the G and then x, y or z to move the images so that they would align at the same beginning point.

Aligning

The whales in the images were not of the same size so I adjusted the sizes until they looked similar. Here below you can see how I was adjusting the sizes of two images.

Adjusting sizes

I moved the images so that they look as if they are walls and a floor with room for the model between them.

Then I used Shift+A and chose Mesh and then Cube.

By clicking on S I could scale the cube down.

Edit mode or object mode

You have to be in Edit mode to edit the model and object mode to move the model. By clicking on TAB you go into edit mode or you switch between Object mode and Edit mode** at the top, as you can see in the image here.

I moved the cube where I could see it in the front view. Then I clicked on CTRL+R for creating a loop cut right in the center of the cube. It splits the cube in two parts. Then I dragged the mouse over the left half of it and chose Delete vertices. As you can see, the vertices that are chosen are orange in colour.

Then I dragged the mouse over the half of the cube that wasn't deleted, clicked on the Modifiers tool and clicked on the plus for Add modifier.

After clicking on Add modifier I chose Generate and then Mirror.

Object mode or edit mode

You have to choose between Object mode to see and move a model or Edit mode to be able to change the model.

ObjectModeOrEditMode

In FreeCad and Fusion you can use the mouse to select a point, line or face, but in Blender you first have to choose which of these you want to select and work with. These tools are at the top left on the screen.

By clicking on the small Tool logo on the right of the screen you can choose a Modifier. I chose the "Mirror". Then I clicked on clipping.

By hitting Z you can click on Wireframe and then you can see through the object and it's split in half by the mirroring axis. If you want to remove the face where the two mirroring objects touch, you have to delete it. You click on Face select on the upper right, click on the face and delete it. To delete you can click on x and then choose Delete

Swithcing betweeen Wireframe and Solid view

To go back from Wireframe and to Solid view you just click on Z and then choose Solid.

ZandWireFrame

Should I continue?

Maybe this is not my cup of tea. I am not sure if I should continue in Blender....

Final whale modelled out of clay

Modelled out of clay and 3D scanned

I bought clay and sculpted the whale. I used leftover materials that I found at my workplace as a support in the model; a piece of wood and a strip of metal that could be easily bent.

After sculpting the model out of clay, I used the Kiri engine app that I used in week 05 when I scanned a mini model. I placed the model on top of a chair when scanning it and the app scanned most of it, but not all. This is a video showing the model evolving.

Model of whale evolving

Cutting unnecessary parts from the model

Trying to cut

I thought about how to connect the model to a base with the float that will make the model hover in mid air. So the next thing to add to the model was a cylinder. But first it was necessary to delete the chair and the support that had been scanned with the whale model. I had a lot of trouble when trying to delete the lower part of the scan. I tried to draw a form and use the Join and then Cut, but even though I tried it in different ways it just would not perform the cut.

No target body

The program just said that there was no target body.

Still united

Then I tried to cut the model in half, hoping that I could then delete the lower part. I used the Plane cut and moved the parts away from each other. That was possible but when I tried to delete the lower half it deleted the whale also. The parts were still as one, even though I had cut them apart.

Repair

Then I realized that the model had a hole in it and needed repair. I right-clicked on the screen and chose Repair. After the repair, the model turned pink and fluffy! Very funny but not very useful.

Cropping in Kiri Engine

I was getting very frustrated when I got the idea to check out what I could do in the Kiri Engine app. There I saw that it was possible to crop the model. This solved my problems. After cropping the model I was asked if I wanted the model to be baked again and I said yes. Then I downloaded the model.

Cylinder on whale model

Finally, I could add a cylinder at the bottom of the whale model but because of the model needing repairing I could not join the two objects. I decided to download the whale model and the cylinder and check if I could 3D print them.

Multiple objects

Bambu Studio asked if I wanted to import the file as single object having multiple parts. I said yes.

Multiple objects failure

This did not go well. The cylinder was not in the right place.

Repair in Bambu Studio

Then I noticed the notification at the bottom. Did you know that Bambu Studio also has a repair option!!! Much better!!! See the textbox on bottom right. I deleted the cylinder, clicked on it and it fixed the model for me.

Exported from Bambu Studio and imported into Fusion

Then I exported it from Bambu Studio as a .stl and imported it into Fusion.

Combined!

At last I could join the whale and the cylinder.

Final whale model on SketchFab

The model on SketchFab

I know that all final files must be in the repository. This whale model is in my repository but you can also see it on Sketchfab here.

3D printing the whale model

Material

I used Greentech pro PLA filament.

Printer and nozzle

As you can see in this image, I used the Bambu Lab X1 Carbon to 3D print. I used a 0.4 nozzle in all prints.

Threshold angle changed

I decided to change the threshold angle from 30° to 40° to add more support.

The PCBs

A PCB board with Raspberry Pi Pico

RPP with two Neopixels

In week 2 I designed and produced a PCB board with a Raspberry Pi Pico microcontroller and two Neopixels. The board was designed in week 02 and produced in week 08. The plan was to have the Raspberry Pi Pico and the Neopixels on one PCB and fasten it with screws to a plexiglass plate. Then I planned on having a button on a seperate PCB. I used the same methods as in previous weeks when I designed the PCBs as described below.

Three seperate PCBs

Three seperate PCBs

I decided to create three seperate boards for the Raspberry Pi Pico microcontroller, the Neopixels and the button. This was just a decision and was not performed.

Doppler radar added

Doppler radar added to project

I decided to add a Doppler radar to the final project. I tested the Doppler radar in week 11 and managed to use it to communicate with Neopixels, so that the Neopixels turned on the light when the Doppler radar sensed movement. When I thought about how to organize the PCBs, I decided that it would be best to place the Doppler radar on one board. It think it's not necessary to mill traces, because the Doppler radar is ready on a board, but I needed to fasten it on a bigger plate. That would make it easier to fasten it to brackets.

Since the previous plan was to have the other components on three PCBs, the final number of PCBs was up to four.

PCB with Raspberry Pi Pico W

Mistakes

Pins in wrong direction

When I designed the PCB in the PCB editor I accidentally turned the pins the wrong way. For that reason the traces were also in the wrong place.

PCB design showing failure

Here you can see that the tracks lie around the pins.

3D model showing failure

This is a 3D model showing how pins turn the wrong way.

Second attempt to design the PCB with RPPW

Second attempt at designing the PCB with the RPPW

Below is the schematic design for the PCB with the Raspberry Pi Pico W. Button is connected to GPIO 4 Doppler radar is connected to GPIO 26 Neopixels are connected to GPIO 10

PCB editor with the RPPW 2

This is a screenshot of the design in the PCB editor.

Step file for Raspberry Pi Pico W exported from Kicad

Below you can see a 3D view of the PCB. When the design for the Raspberry Pi Pico W was ready, I exported it as a .step file from Kicad. Then I imported the .step file into Fusion when I was designing the enclosure/base, as I described here before

The PCB milled

Below you can see the PCB milled

PCB with Neopixels

Schematic design

Schematic

This is the schematic design for the PCB with the Neopixels. I used it for different designs in the PCB editor, both for a PCB board and soft copper foil traces when I was experimenting to find the best solution.

Which pins to use for Neopixels

Connect Neopixels to these pins

According to Adafruit Neopixels only work if they are connected to GPIO10, GPIO12, GPIO18 or GPIO21. The standard pin is GPIO18.

I connected the Neopixels to GPIO 10.

PCB board for Neopixels

I found a video that explained how you could import images into Kicad. I did a quick check and saw that I would have to zoom in on the world map for the Neopixels to fit on the map. Then I realized that it would probably be best to cut the traces in the vinyl cutter instead of using a PCB board. Below is the quick check that I made in Kicad and I explain the steps later.

I took a screenshot of this map and imported it into Inkscape (see image below). I chose Object and then Trace bitmap to create a vector drawing of the image. Then I deleted the original image. After that I adjusted the size of the vector image. Finally, I saved the image as a .dxf file.

Importing a .dxf drawing for reference into Kicad

Importing a .dxf drawing into Kicad

I imported the .dxf file into Kicad by choosing Import and then Graphics.

Choosing which layer you want the drawing to be in

I chose the User.drawings layer.

Settings for track width and more

Settings for traces in Kicad

I clicked on File and then Board setup. There I clicked on Netclasses. I chose the settings that you can see in the image below:

Arranging components with a drawing as a reference

Drawing used as a reference

I placed the Neopixels where I wanted them to be on the map. I placed the capacitors so that each of them was close to a Neopixel and by placing them above the Neopixels I could use them as a bridge over traces from other Neopixels. I placed the resistor on the Data track. Since the pins were supposed to be under the plate, The traces were placed in a straight line up so that they would fold easily around the edge of the plate and they are long enough to go over and under.

The copper foil, that the traces would be cut out of, is very thin. After measuring it the size of it was drawn in Kicad, just to make sure that the traces would fit onto it. This was limiting because this meant that the pins had to be above and not on the left side, close to the microcontroller, but that was not a problem. It only meant that the wires had to be longer.

When everything was wired together and the Design Rules Checker confirmed that the design was okay, I turned of the layer with the map and the plan was to export the design as a .svg. This image below shows the design in the PCB editor.

Issue with exporting a .svg from Kicad

Exporting a .svg from Kicad

I wanted to export the design as .svg from the PCB editor so that i could create a cutting file in Inkscape to cut the traces out of copper foil. I searched and just couldn't find out how.

Svavar told me that Bjartur had used File, Fabrication output. Then the Plot option and chosen .svg as an output. I checked and it was possible by changing the Plot format (see the upper left corner). Then I chose the file destination by clicking on the small folder symbol at the upper right and then i clicked on Plot.

Creating a cutting file for traces in Inkscape

Traces prepared in Inkscape

I opened the .svg file and deleted everything except the traces. I also had to combine all forms by clicking on Path and then Union because each straight line appeared to be a single form and the traces would all be cut apart if this was not done. In the image below you can see this process halfway; some lines are still single and in other parts of the traces the forms have been united. When everything was combined I turned off Fill, turned Stroke paint on and tuned the red colour up to 255. Then I set the Stroke style to 0.02. Then I clicked on File and Document properties to Resize to content**. Finally, I saved a .pdf file.

Copper foil tests

When I attended the Bootcamp in Húsavík, Svavar helped me do the first test in cutting a copper foil. The first test did not go well and then I ran out of time, so I had to continue on my own in Neskaupstaður.

Changing offset, speed and force in the Roland GX-24 vinyl cutter

Cutting settings

I found this information about settings for the Roland GX-24 vinylcutter. I was not sure which settings were ideal for copper foil, so I decided to do some testing. By setting the force to 150 the results were good.

I used a 60° blade and according to these information, I had to change the offset because the measurement from the edge of the blade to the middle of it differs between blades of different angles.

Offset, force and speed settings

I knew how to change the settings for force but I had no idea on how to change offset or speed. I found this video that explains how to change settings in the Roland vinyl cutter. It is not obvious so I will describe each step later, but first you can see a screenshot from the video that shows different offset settings for blades with different angles.

Offset, force and speed settings - step by step

To change the settings for offset, speed or force you first have to put the material (any material) in place and click on the Down arrow and then choose between Piece, roll or edge. Then click Enter. When the plotter has moved to it's place you click on Menu.

Click on Menu two times

You have to click on Menu two times to get the Unsetup text on the screen.

Click on the Down arrow

When you see the word Unsetup you click on the Down arrow until you see the word Condition.

Condition

When you see the word Condition then you click on the Right arrow. Then you see the word Force.

Force

If you want to change the force, then you click on the Right arrow and adjust the force with the up and down arrows. When you have made your changes you can hit Enter and then Menu to get quickly to be ready to cut a design. You can also back out of the settings with the left arrow.

If you were not planning on changing the Force and want to find other settings, such as for the Speed or the Offset, then instead of using the Right arrow you click on the Down or Up arrows.

Offset

When you see the Condition text, you click on the right arrow. Then you use the Up or Down arrows to find settings for the Offset. If you want to change the offset, then you click on the Right arrow and adjust the offset with the up and down arrows. When you have made your changes you can hit Enter and then Menu to get quickly to be ready to cut a design. You can also back out of the settings with the left arrow.

Speed

When you see the Condition text, you click on the right arrow. Then you use the Up or Down arrows to find settings for the Speed. If you want to change the speed, then you click on the Right arrow and adjust the speed with the up and down arrows. When you have made your changes you can hit Enter and then Menu to get quickly to be ready to cut a design. You can also back out of the settings with the left arrow. After hitting the Menu button you can see the main settings on the screen (see image below).

The copper foil tests

Tests

These are the four attempts at cutting the traces out of copper foil. None of them is good and the 60°knife (second from bottom) is not better than the other ones. The best one (lowest one on the picture) was done with Force set to 150, speed at 10cm/s and by using the 45°knife (with offset .25). I was not happy with the results.

New PCB for Neopixels since vinylcutting did not work

New design using the same schematic

I decided to do a new design for a PCB board but use the same schematic. It was supposed to be fastened onto a black plexiglass plate so I drew holes on it. The plate was barely big enough, 15.2cm x 15.2cm, so I had to place the holes unevenly.

Errors and warnings

I had to move silkscreen markings and to add a connection through the resistor for all to be without errors and warnings.

Generating Gerbers and using Gerber2PNG website

Gerber2PNG

In week 08 I explain how to generate Gerber files and also how to use the Gerber2PNG website that Fab Lab Kerala made to genetate .png.

Placing holes in PCB design match with holes in Inkscape

Holes in the PCB plate had to fit with holes in plexiglass

I exported the PCB design as a .svg by choosing File, Fabrication output, Plot and then choose .svg as an output by changing the Plot format. Then I chose the file destination by clicking on the small folder symbol at the upper right and then i clicked on Plot. Then I opened the file with Inkscape and added the outlines for the plexiglass plates and the map. This way I could place the traces where I wanted them and also use the lines for holes (see the grey circles).

Holes in the PCB plate had to fit with holes in plexiglass

Then I deleted everything that I didn't need until I had only the cutting lines for outlines and holes. I also added a small rectangle where I wanted the wires to be held in place and go into the enclosure.

So many mistakes

Too many lines and holes too big

When I cut the plexiglass I realized that I had made two mistakes. I forgot to delete the outline of the PCB that was supposed to be surface mounted on top of this plexiglass. I could also see that instead of making the diameter of the holes 3mm I set the radius to 3mm and the holes were too big. Fortunately the Roland Monofab SRM-20 was still just milling the traces so I could change the edge cuts for the PCB. Unfortunately I had to make another plexiglass.

The top line in the edge cut was not done in the MonoFab SRM-20

When milling and cutting the board in the MonoFab SRM-20, the top line was not cut. It looks as if the line went out of the working area of the machine, so the next time I will have to place the plate differently.

There was so little that needed cutting that I decided to use a small saw, that I have used for working with silver, to cut the small parts.

Soldering did not go well

When I soldered the board it did not go well. I used a soldering station and the Neopixels melted so easily. I ruined some of them and I think the reason is the tip of the solder iron, which was not small. Then I accidently broke the pins off, even though I was trying to be careful.

I decided to do an experiment and solder wires directly onto the board, instead of using pins. This way I would need less space between the upper plexiglass and the plexiglass that this PCB would be surface mounted on.

Fab Academy on Fishermen's day in Iceland

Fishermen's day

In the beginning of june the Fishermen's day is celebrated in Iceland. In my hometown ships and small boats sail together on this day. Here I was milling the PCB and watching my family and friends sailing.

View from Fab Lab Austurland on Fishermen's day

New PCB milled and soldered

New PCB milled and soldered

Since I was not happy with my work on the PCB I decided to mill another one. The one I milled had the cutting line at the top missing and also a part of the GND marking. This time everything was milled and cut. This tells me that I have to be accurate when placing PCBs in the Roland MonoFab SRM-20 because the working area seems to be limited. Se the older one and the new one below:

Mistakes

Troubleshooting

When I connected the board, only six of ten Neopixels lighted up and I could not find out what was wrong. I asked Svavar Konráðsson and Þórarinn Bjartur Breiðfjörð for help and they recommended checking if there was a short circuit somewhere and also check if the connections were good enough. I had already done that and could not see the problem. I had also removed and placed new Neopixels for nr. 6 and 7.

Þórarinn Bjartur Breiðfjörð also mentioned the oscilloscope and I used it to see where the signal was appearing and where it was not. This helped because I found that the signal was not coming out of the DOUT (Data out) on Neopixel nr. 6. This way I knew where the problem was.

More troubleshooting

I got worried that I might destroy the PCB by removing a Neopixel once more, because the traces can be destroyed and burned. Neopixels are fastened in four places and that is what makes removing them difficult. I asked a co-teacher, Viðar Guðmundsson, to help me and he used one soldering iron to heat up one side of the Neopixel, two pins at a time, and I heated up the other side. Then I could lift it off with tweezers. He told me to measure also the empty space between pins and different pins. He also told me that I could compare Neopixels, so that you measure between two pins (all pins, not just power and ground or only data pins) on one Neopixel and then the same pins on all the other Neopixels and this way you might see a difference and find a short circuit. This way I found out that there were tiny bridges under Neopixel nr. 6 that led to the empty space and connected pins that should not be connected. After cleaning the area with Quick braid and soldering a new Neopixel, the board with the Neopixel worked!!!

Videos showing Neopixels working

Neopixels showing how the humpback whale travels

These videos show how the Neopixels work; how the humpback whale travels from Iceland to the Caribbean ocean.

Neopixels blinking on the PCB

Neopixels blinking on map

PCB with button

Buttons - small and big

I used the same processes as described before when I made the PCB with the SMD button. A bigger silicon button, that I made in moulding and casting week, will be placed in front of this small button. Here you can see the small and big button in the enclosure design in Fusion.

Schematic and PCB design for button

Schematic of button PCB

This image below shows the schematic design for the PCB board with button. There are only two pins, one for ground and one for connection to GPIO 4 on the microcontroller.

PCB design of button PCB

This is a screenshot from PCB editor of the board.

Button PCB board milled and soldered

This is the PCB board with the button milled and soldered. I decided to add markings for power and ground.

Sticker labels on the backside of the PCBs

Stickers to prevent mixup

I got worried that I might mixup the pins on the PCBs and fry something, so I decided to label them on the backside. I had already milled labels on the front side but when the PCBs are in place, all I see is the backside. We have a Roland VersaSTUDIO BN-20A that can print and cut stickers.

I opened Inkscape, clicked on the Letter symbol and wrote the labels on the pins. Then I clicked on the rectangle tool and drew a rectangle around all stickers. I used these rectangles as cutting lines by clicking on Object and Fill and stroke. Then I chose a color for the line and set the line to 0.1. You can use any colour for the line when you are creating a cutting line for this printer. I am not sure how thin or thick the lines can be, but I have made stickers with different thickness and they have all worked as a cutting line.

When the design was ready and I had decided the size of it, I clicked on File and Document properties. Then I resized the page to the size of the sticker. Then I saved it as a PDF.

I opened the folder and dragged the PDF file over into the VersaWorks program. Then I right-clicked on it and chose Job assistant. There I clicked on the knife symbol on the left border. Next I clicked on the lines that I wanted to change to cutting line and clicked on Create. Finally, I clicked on Ok and answered Yes.

The program created a new file with the cutting lines so I deleted the previous file that did not have cutting lines. The file that has an A inside a rectangle is the file with the cutting line.

I chose the file from the list (it turned blue) and clicked on the Printer symbol. Then the machine printed and cut the stickers.

The code

Working on code with Neopixels

I learned how to use Neopixels and made two Neopixels change colours. This was done in week 08.This is the code I used and it was Svavar Konráðsson who helped me write it:

import neopixel
from machine import Pin
import time

pixPin = 0  # Numper of pin
pixSize = 2  # How many LEDs
pix = neopixel.NeoPixel(Pin(pixPin), pixSize)  # Initialization

yellow = (255,255,0)
red = (255,0,0)

while True:
    pix[0] = yellow
    pix[1] = red
    pix.write()  # Tells the LED to perform the command

    time.sleep(1)
    pix[0] = red
    pix[1] = yellow
    pix.write()  # Tells the LED to perform the command
    time.sleep(1)

Adding Doppler radar

Doppler radar added

I had decided to add a Doppler radar to the program as an input. In the program the Neopixels start blinking when the Doppler radar senses movement. In this code I mixed the code from spiral 1 (here above) and a code that I used for Doppler radar in week 11.

I noticed that my Neopixels did not turn off in my previous experiments, so I have to tell them to turn off. I found here that I could possibly set the Neopixel to (0,0,0) to turn them off. I decided to set it up as off = (0,0,0) and it worked!

Here you can see the code after I mixed them together:

from machine import Pin, I2C
import network
import time
import neopixel

sensor_pin = 26
sensor = Pin(sensor_pin, Pin.IN)
pixPin = 0  # Numper of pin
pixSize = 2  # How many LEDs
pix = neopixel.NeoPixel(Pin(pixPin), pixSize)  
blue = (0,0,255)
white = (255,255,255)
off = (0,0,0)
state = 0
val = 0

while True:
    val = sensor.value()  # read sensor value
    if val == 1:  # check if the sensor is HIGH       
        pix[0] = blue
        pix[1] = white
        pix.write()  # Tells the LED to perform the command
        if state == 0:
            print("Motion detected!")
            state = 1  # update variable state to HIGH
    else:
        if state == 1:
            print("Motion stopped!")
            state = 0  # update variable state to LOW          
            pix[0] = off
            pix[1] = off
            pix.write() 

    time.sleep(0.1)

Video showing Doppler radar activating Neopixels

Here you can see a video that shows how the Neopixels are activated when the Doppler radar senses movement.

Turning the globe

Neopixels

The final code in progress

I added Neopixels to the code.

I want the path to light up all the way from Iceland and to the Dominican Republic and then I want it to go backwards, because the whales travel back and forth. Each time a new Neopixel lights up I want the previous one to turn off, so I begin by setting the previous one to off, which I defined as (0,0,0). Then I tell the next Neopixel to turn on the blue light by writing blue, which is defined as (0,0,255).

I have to find out the best way to create a loop and I found these information on different ways to create repetition or loop. (work in progress - have to test it)

Small mistake in code

Too many Neopixels

This code has too many Neopixels. Since it begins counting at zero, it should only go up to nine if using ten Neopixels.

from machine import Pin, I2C
import network
import time
import neopixel

sensor_pin = 26
sensor = Pin(sensor_pin, Pin.IN)

pixPin = 10  # Numper of pin
pixSize = 10  # How many LEDs
pix = neopixel.NeoPixel(Pin(pixPin), pixSize)  # Initialization

blue = (0,0,255)
off = (0,0,0)

# Initialize state variables
state = 0
val = 0

while True:
    val = sensor.value()  # read sensor value

    if val == 1:  # check if the sensor is HIGH

        pix[0] = blue
        pix.write()  
        time.sleep(1)

        pix[0] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[2] = blue
        pix.write() 
        time.sleep(1)

        pix[2] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1) 

        pix[5] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[9] = blue
        pix.write() 
        time.sleep(1) 

        pix[9] = off
        pix[10] = blue
        pix.write()
        time.sleep(1)  

        pix[10] = off
        pix[9] = blue
        pix.write() 
        time.sleep(1) 

        pix[9] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1)

        pix[5] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[2] = blue
        pix.write()  
        time.sleep(1)

        pix[2] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[0] = blue
        pix.write()  
        time.sleep(1)

        if state == 0:
            print("Motion detected!")
            state = 1  # update variable state to HIGH
    else:

        if state == 1:
            print("Motion stopped!")
            state = 0  # update variable state to LOW

            pix[0] = off
            pix[1] = off
            pix[2] = off
            pix[3] = off
            pix[4] = off
            pix[5] = off
            pix[6] = off
            pix[7] = off
            pix[8] = off
            pix[9] = off
            pix[10] = off
            pix.write() 

    time.sleep(0.1)

Button added to code

Add button

The next step was to add a code for the button. I found directions here and it is mentioned that some microcontrollers do not have a pull up resistor on all pins, so I Googled and found information here that explained how the Raspberry Pi Pico has internal pull up resistor.

The code for the button comes from here and looks like this:

import machine
button = machine.Pin(12, machine.Pin.IN, machine.Pin.PULL_UP)

I noticed that this code is very similar to the code from here and used to control a motor in week 10. The difference is that the motor code uses from machine import Pin and defines motor instead of button. The IN in machine.Pin.INdefines the button as input. I will use from machine import pin and use GPIO 4.

from machine import Pin, I2C
import time
import neopixel

button = machine.Pin(4, machine.Pin.IN, machine.Pin.PULL_UP)
sensor_pin = 26
sensor = Pin(sensor_pin, Pin.IN)

pixPin = 10  # Numper of pin
pixSize = 10  # How many LEDs
pix = neopixel.NeoPixel(Pin(pixPin), pixSize)  # Initialization

blue = (0,0,255)
off = (0,0,0)

# Initialize state variables
state = 0
val = 0

while True:
    if button.value():
        time.sleep(0.1)
    if not button.value():
        val = sensor.value()  # read sensor value
    if val == 1:  # check if the sensor is HIGH

        pix[0] = blue
        pix.write()  
        time.sleep(1)

        pix[0] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[2] = blue
        pix.write() 
        time.sleep(1)

        pix[2] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1) 

        pix[5] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[9] = blue
        pix.write() 
        time.sleep(1) 

        pix[9] = off
        pix[10] = blue
        pix.write()
        time.sleep(1)  

        pix[10] = off
        pix[9] = blue
        pix.write() 
        time.sleep(1) 

        pix[9] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1)

        pix[5] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[2] = blue
        pix.write()  
        time.sleep(1)

        pix[2] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[0] = blue
        pix.write()  
        time.sleep(1)

        if state == 0:
            print("Motion detected!")
            state = 1  # update variable state to HIGH
    else:

        if state == 1:
            print("Motion stopped!")
            state = 0  # update variable state to LOW

            pix[0] = off
            pix[1] = off
            pix[2] = off
            pix[3] = off
            pix[4] = off
            pix[5] = off
            pix[6] = off
            pix[7] = off
            pix[8] = off
            pix[9] = off
            pix[10] = off
            pix.write() 

    time.sleep(0.1)

Failure in code

Code not working as it should

This code made the button work but instead of the button turning on the Doppler radar, pushing the button turned the Neopixels on immediately. Well,I am not okay with the Doppler radar not working but I would be happy with either of these functions:

a: The button activates the Doppler radar when it is pushed and then the Doppler radar activates the Neopixels when it senses movement.

b: The button activates the Neopixels when it is pushed or the Doppler radar activates the Neopixel when it senses movement.

I tried to change the code in different ways:

While True added

I tried to add an extra while Truebut that did not work. I tried to change the indent to get rid of the error warning but that did not work. See image below.

while True:
    time.sleep(0.01)
    if not button.value():
while True:
    val = sensor.value()  # read sensor value
    if val == 1:  # check if the sensor is HIGH

Code not working as it should

On this website I could see that it is possible to use or command, so that was the next thing I tried. That did not work. Thonny said that there was an ``SyntaxError: invalid syntax in the line with the or command.

while True:
if not button.value() or val = sensor.value():
if val == 1:  # check if the sensor is HIGH

First and second

Next I tried to use First and Second to try to make the button first activate the Doppler radar. I found an example of this here. This example also used elif, which is a short for else if.

This change worked for the button but not the Doppler radar:

while True:
first = button.value()
time.sleep(0.01)
second = sensor.value
if first and second:  
    if not button.value():
        val = sensor.value()
if val == 1: 

Elif

Then I tried to change the code and add Elif with the example from the webpage that I mentioned here above. It did not work. All I got was an error in Thonny telling me that there was an IndentationError: unexpected indent. When I tried to move the command Elif it did not work and when I removed all indent it showed: SyntaxError: invalid syntax. I also tried to use the word Else but that did not change anything.

from machine import Pin, I2C
import time
import neopixel

button = machine.Pin(4, machine.Pin.IN, machine.Pin.PULL_UP)
sensor_pin = 26
sensor = Pin(sensor_pin, Pin.IN)

pixPin = 10  # Numper of pin
pixSize = 10  # How many LEDs
pix = neopixel.NeoPixel(Pin(pixPin), pixSize)  # Initialization

blue = (0,0,255)
off = (0,0,0)

# Initialize state variables
state = 0
val = 0

while True:
    time.sleep(0.01)
    if not button.value():

        pix[0] = blue
        pix.write()  
        time.sleep(1)

        pix[0] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[2] = blue
        pix.write() 
        time.sleep(1)

        pix[2] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1) 

        pix[5] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[9] = blue
        pix.write() 
        time.sleep(1) 

        pix[9] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1)

        pix[5] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[2] = blue
        pix.write()  
        time.sleep(1)

        pix[2] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[0] = blue
        pix.write()  
        time.sleep(1)

            elif button.value():
    val = sensor.value()  # read sensor value
    if val == 1:  # check if the sensor is HIGH


        pix[0] = blue
        pix.write()  
        time.sleep(1)

        pix[0] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[2] = blue
        pix.write() 
        time.sleep(1)

        pix[2] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1) 

        pix[5] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[9] = blue
        pix.write() 
        time.sleep(1) 

        pix[9] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1)

        pix[5] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[2] = blue
        pix.write()  
        time.sleep(1)

        pix[2] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[0] = blue
        pix.write()  
time.sleep(1)

if state == 0:
    state = 1  # update variable state to HIGH
else:

        if state == 1:
            state = 0  # update variable state to LOW

            pix[0] = off
            pix[1] = off
            pix[2] = off
            pix[3] = off
            pix[4] = off
            pix[5] = off
            pix[6] = off
            pix[7] = off
            pix[8] = off
            pix[9] = off
            pix.write() 

    time.sleep(0.1)

Just if

Then I took away the elif or else and only added if but like before, that only worked for the button.

from machine import Pin, I2C
import time
import neopixel

button = machine.Pin(4, machine.Pin.IN, machine.Pin.PULL_UP)
sensor_pin = 26
sensor = Pin(sensor_pin, Pin.IN)

pixPin = 10  # Numper of pin
pixSize = 10  # How many LEDs
pix = neopixel.NeoPixel(Pin(pixPin), pixSize)  # Initialization

blue = (0,0,255)
off = (0,0,0)

# Initialize state variables
state = 0
val = 0

while True:
    time.sleep(0.01)
    if not button.value():

        pix[0] = blue
        pix.write()  
        time.sleep(1)

        pix[0] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[2] = blue
        pix.write() 
        time.sleep(1)

        pix[2] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1) 

        pix[5] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[9] = blue
        pix.write() 
        time.sleep(1) 

        pix[9] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1)

        pix[5] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[2] = blue
        pix.write()  
        time.sleep(1)

        pix[2] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[0] = blue
        pix.write()  
time.sleep(1)

if button.value():
    val = sensor.value()  # read sensor value
    if val == 1:  # check if the sensor is HIGH


        pix[0] = blue
        pix.write()  
        time.sleep(1)

        pix[0] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[2] = blue
        pix.write() 
        time.sleep(1)

        pix[2] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1) 

        pix[5] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[9] = blue
        pix.write() 
        time.sleep(1) 

        pix[9] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1)

        pix[5] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[2] = blue
        pix.write()  
        time.sleep(1)

        pix[2] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[0] = blue
        pix.write()  
time.sleep(1)

if state == 0:
    state = 1  # update variable state to HIGH
else:

        if state == 1:
            state = 0  # update variable state to LOW

            pix[0] = off
            pix[1] = off
            pix[2] = off
            pix[3] = off
            pix[4] = off
            pix[5] = off
            pix[6] = off
            pix[7] = off
            pix[8] = off
            pix[9] = off
pix.write() 

time.sleep(0.1)

What now?

Well, at this point I have not found out how to use both the button and the Doppler radar together in a code. I gave up on searching because I had spent so much time searching for this answer and time is running out. I asked for help and Árni Björnsson found out what was wrong. It was simply this line that was the right thing to use: if not button.value() or sensor.value():

So simple but I couldn't find it without help.

The final code

The final code

Here you can see the final code:

from machine import Pin, I2C
import network
import time
import neopixel

button = machine.Pin(4, machine.Pin.IN, machine.Pin.PULL_UP)
sensor_pin = 26
sensor = Pin(sensor_pin, Pin.IN)

pixPin = 10  # Numper of pin
pixSize = 10  # How many LEDs
pix = neopixel.NeoPixel(Pin(pixPin), pixSize)  # Initialization

blue = (0,0,255)
off = (0,0,0)

# Initialize state variables
state = 0

while True:
    if not button.value() or sensor.value():  
        pix[0] = blue
        pix.write()  
        time.sleep(1)

        pix[0] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[2] = blue
        pix.write() 
        time.sleep(1)

        pix[2] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1) 

        pix[5] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[9] = blue
        pix.write() 
        time.sleep(1) 

        pix[9] = off
        pix[8] = blue
        pix.write() 
        time.sleep(1)  

        pix[8] = off
        pix[7] = blue
        pix.write() 
        time.sleep(1) 

        pix[7] = off
        pix[6] = blue
        pix.write() 
        time.sleep(1)

        pix[6] = off
        pix[5] = blue
        pix.write() 
        time.sleep(1)

        pix[5] = off
        pix[4] = blue
        pix.write()  
        time.sleep(1)

        pix[4] = off
        pix[3] = blue
        pix.write()  
        time.sleep(1)

        pix[3] = off
        pix[2] = blue
        pix.write()  
        time.sleep(1)

        pix[2] = off
        pix[1] = blue
        pix.write() 
        time.sleep(1)

        pix[1] = off
        pix[0] = blue
        pix.write()  
        time.sleep(1)

        if state == 0:
            state = 1  # update variable state to HIGH
    else:

        if state == 1:
            state = 0  # update variable state to LOW

            pix[0] = off
            pix[1] = off
            pix[2] = off
            pix[3] = off
            pix[4] = off
            pix[5] = off
            pix[6] = off
            pix[7] = off
            pix[8] = off
            pix[9] = off
            pix.write() 

time.sleep(0.1)

Powering the project

Powering the magnetic levitation module and the Raspberry Pi Pico W

Svavar Konráðsson showed me how to use a 5V step-up/step-down voltage regulator to connect the Raspberry Pi Pico and the Magnetic levitation module with one power input. This video, Power for the Raspberry Pi Pico - Guide to using VBUS, VSYS and 3V3 for external power circuits, provides some basic information on how you can power the Raspberry Pi Pico. Here are some points from that video:

Through the VSYS the Raspberry Pi Pico can be powered at mininum 1.8V and maximum 5.5V but through the VBUS it should be powered with 5V (plus or minus 10%). The current can be between 18mA to 95mA.

  • 3.3V can give a maximum 300mA output.

  • The USB is connected directly to the VBUS.

  • If the plan is to connect external power to VBUS it is recommended to use the USB rather than pin 40.

  • You can connect external power to the VSYS pin, which is number 39.

  • A protection diode is placed between the VSYS and the VBUS. It prevents backfeeding power to the USB and protects against incorrect polarity.

  • Pin 36 can be used for external circuits at maximum 300mA.

  • A schottky diode can be used between VBUS and VSYS to prevent external power supply from backfeeding the USB power supply. It also prevents the external circuitry from using power from the USB supply.

  • If you use the schottky diode like this you can use an external power supply and connect the Raspberry Pi Pico through the USB without disconnecting the external power supply.

Then I connected the magnetic levitation module using this as a reference, see screenshot:

Code to check if the levitation model and the microcontroller work

Svavar Konráðsson wrote a simple code, based on Neopixel code from week 08 with all eight Neopixels turning red. We used this code just to see if everything worked as it should after connecting the Magnetic levitation module and the Raspberry Pi Pico W to the same voltage regulator, see week 08. This is the code:

import neopixel
from machine import Pin
import time

pixPin = 0  # Numper of pin
pixSize = 2  # How many LEDs
pix = neopixel.NeoPixel(Pin(pixPin), pixSize)  # Initialization

red = (255,0,0)

while True:
    pix[0] = red
    pix[1] = red
    pix[2] = red
    pix[3] = red
    pix[4] = red
    pix[5] = red
    pix[6] = red
    pix[7] = red
    pix.write()  
    time.sleep(1)

Assembling

Buttons

I placed the silicone button that I had designed in moulding and casting week week 14 and tested it with this code from this website:

```py import machine

button = machine.Pin(12, machine.Pin.IN, machine.Pin.PULL_UP) while True: if not button.value(): print('Button pressed!') ```` As you can see in the video the button works when it is pushed but the problem is that it is not moving back into original place so it prints constantly button pushed. I saw that this was because the button was designed with a fillet and I had not given the fillet space. I used a file and made the opening wider on the inside. After that the button fitted perfectly and I could hear the small smd mounted button behind the silicone button click.

Button stuck

Doppler radar

I designed a simple PCB plate only with holes and fastened the Doppler radar to it with tiny screws and bolts.

Small plexiglass window to hide Doppler radar

I laser cut a small plexiglass window to hide the Doppler radar.

Small plexiglass window to hide Doppler radar

I used a soldering iron to melt heat inserts into the socket poles that I used under the magnetic levitation module.

Powercord in place

In the image below you can see how the power cord sits tightly in the fasteners. You can also see one of the supports/sockets with a heat insert. One more thing that can be seen in the image is how I labelled the pins on the backside of the PCBs.

Inner walls

I did my best to make the system integration and packaging clean and organized. I 3D printed inner walls that were used to hide components. I also used them to hold the PCBs in place by designing extruding walls that fell into the slots beside the PCBs. That worked well but I would have liked to have the walls a bit tighter fit.

Mistakes

The walls fell neatly into place and held the PCBs in place but I forgot to design something on the other side of two of the PCBs. The walls are a bit too loose so I need to make the part that slide into the slots a bit thicker.

Inner walls in place

Here you can see what the inside of the enclosure looks like after assembling.

Magnetic levitation module with lights

Here you can see the magnetic levitation module plugged in. It came with these lights and they look very nice. I had to hide the lights with a black plexiglass plate so that the Neopixel lights under the map could be seen without these lights interrupting. Still, if I want to show students the magnetic levitation module, the lights on it look cool

Neopixels show how Humpback whale swims in the ocean

Presentation slide and video

Canva used to design slide

I used Canva to design the final presentation slide.

CapCut and Canva used to create final video

I used Canva to design the title page, the last page and one slide in the video. Then I used CapCut to create the video. I learned how to use CapCut in Machine week and you can read about it here. I used the same method when creating this final video.

The music in the video is The wave song by BCD Studio CC. I found it in the music section in CapCut.

Files for final project

File for tracking of whales

File for webpage with the tracking of whales

This webpage with information about the tracking of different species of whales comes from the North Atlantic Marine Mammal Commision.

File for tracking of whales

File for whale model - before it was repaired in Bambu Studio

This model was exported from the Kiri Engine 3D scanning app after cropping the chair from the model. Then the model was imported into Fusion but it needed repairing because of non-manifolding edges. This repair was done later in Bambu Studio.

Whale model with cylinder - .3mf

Whale model with cylinder - .stl

File for whale model with cylinder

This is the final model exported from Fusion.

Final whale model

Enclosure/base

Enclosure for float - did not work

This .f3z Fusion file includes the final enclosure, the inner walls and the final whale model. It also includes the support poles for the heat inserts. It shows all changes from the first spiral.

Enclosure - base

Enclosure for float - did not work

This file has the poles for the heat inserts, used to keep the magnetic levitation module in its place.

Poles for heat inserts - .f3z

Enclosure for float

Enclosure for float - did not work

These three files show three attempts at designing an enclosure around the magnetic float. None of them worked. They were too big and the float did not float. There were also mistakes in making the thread.

Enclosure for float/first attempt - .f3z

Enclosure for float/second attempt - .f3z

Enclosure for float/third attempt/lighter version - .f3z

Enclosure for float - changed to a socket, only upper half

This is the socket I used to place the whale model on top of the magnetic float. I only used the upper half and deleted the lower half when I opened the file in Bambu Studio.

Final socket used on top of float - .f3z

Plexiglass map

Files used to create the plexiglass map and also in Kicad design

Files used to create the upper plexiglass. Outline of plexiglasses was exported as .dxf file and imported into Inkscape. After adding the map to the outlines of both upper and lower plexiglass in Inkscape, it was exported as a .dxf. Then it was imported into Kicad to use as a reference.

Upper plexiglass - .svg

Upper plexiglass - .pdf

Outline of plexiglass exported from Fusion - .dxf

The map as .dxf

Upper plexiglass with map - .dxf

Lower plexiglass for PCB with Neopixels - .svg

Lower plexiglass for PCB with Neopixels - .pdf

Outline of lower plexiglass exported from Fusion - .dxf

Lower plexiglass with map - .dxf

Plexiglass window for Doppler radar

Window

This is the design for the small, blue plexiglass window that was press-fitted in front of the Doppler radar.

Plexiglass window for Doppler radar - .svg

Plexiglass window for Doppler radar - .pdf

Electronics files

PCB with Raspberry Pi Pico W - first attempt (mistake)

PCB for RPPW - failure

These are the files for the PCB with the RPPW. They were a failure because I turned the pins the wrong way.

PCB with RPPW - .prl

PCB with RPPW - .pro

PCB with RPPW - .sch

PCB with Raspberry Pi Pico W - second attempt (final)

PCB with button

Files for smd button

Here are the Kicad files and .png for the PCB with the smd button. The step file was exported from Kicad and used as a component in Fusion design.

Button PCB outline - .png

Button PCB traces - .png

Button PCB - .Edge_cuts.gbr

Button PCB - F_Cu.gbr

Button PCB - .pcb

Button PCB - .prl

Button PCB - .E

Button PCB - .gbrjob

Button - step file

Files for PCB with Neopixels

Files for PCB with Neopixels

Here are the Kicad files and .png for the PCB with Neopixels. My first attempt was to create traces that were supposed to be cut out of copper foil, but that did not work. Then I used the same schematic design to create a PCB plate.

Traces for vinylcutting copper foil- .pdf

Traces for vinylcutting copper foil-.svg

Outline for copper foil

Traces for Neopixel PCB - .pcb

Traces for Neopixel PCB - .prl

Traces for Neopixel PCB - .pro

Traces for Neopixel PCB with too big holes - .png

Traces for Neopixel PCB with holes fixed - .png

Traces for Neopixel PCB

No electronics, only a PCB plate for Doppler radar

Files for Doppler radar

I only needed outline and holes for screws to fasten the Doppler radar. Here are the Kicad files, the .png and a step file that I used as a component in the Fusion design.

Outlines for PCB for Doppler - .png

Doppler radar PCB - .pcb

Doppler radar PCB - .prl

Doppler radar PCB - .pro

Doppler radar PCB - .sch

Doppler radar - step file

Code files

Thonny files with codes

Here below is a Thonny file with the final code. Below it are two Thonny files; one of them worked only for the Doppler radar but not the button and it was the other way around in the file at the bottom.

Final code

Code only worked for Doppler

Code that only worked for button

A small extra project

Importing a .dxf drawing into Kicad

Jóhannes Andrésson asked me if I could draw a wolf for him. He had designed everything himself and only needed the drawing of the wolf, so I did not do much. You can see how he used the drawing in his design on his final project. This is my drawing:

Sköll - Inkscape file