Wednesday, May 21, 2014

Car intake scoop with 3D printing

In this post I go through the steps of designing a 3D printed prototype of a plastic product.

The project I am covering is a cold air intake scoop for a car that sees some track days. The scoop mounts under the front fender and connects to a flexible hose that runs up to the engine compartment. I have made one before for my car, but recently I was asked to sell one. This was also a good opportunity to document the steps of developing a 3D printed end product.

0. Skills shown and acquired:
- CAD modeling
- Designing a plastic product suitable for FDM
- Understanding rapid manufacturing; process and steps involved
- Taking advantage of slicer parameters in efficient prototyping

1. Dimensions and shape

First I observed the car for a convenient mounting location and wrote down some dimensions for existing mounting points. Then I sketched and cut a template of the intake side and trimmed it to desired shape while comparing its fit to the front fender. I also noted which way I wanted the hose to be pointed.

When the template was complete I scanned it and sketched over it in CAD. Next I sketched the shape of the other end to an appropriate place. From there it was easy to extrude the final shape between the ends and add the mounting flanges. I chose to leave the front facing end flat as it will provide good contact with the build plate. The flanges are designed to be easy for the printer to build with no significant overhang.

I left the model intentionally solid for reasons I will explain next.

2. Preparing the 3D print

The model is exported as .stl file and imported to the printed software. For this application I used Cura, which is free and open source. It combines two programs needed for the print; the slicer, which plans the physical moves, and the host, which sends these planned moves to the printer.

The slicer takes in parameters that affect the print. The most important is the layer height. For my printer this can range from 40 microns to 240 microns. Thinner layer height will naturally take longer to print, but the finish is smoother. For this project I set it for 150 microns. Next parameter is the infill rate. This can range from 0 to 100, 0 making the object hollow and 100 making it completely solid. As you can probably guess, I will set this to 0.

The print usually starts with several solid layers to build up the bottom and ends in the same matter, closing the infill inside. As I wan't air to flow through my scoop I will set the bottom and top solid layers to zero.

Now my object will be hollow, but very brittle. Luckily I can also adjust the amount of perimeters the printer will make around the edges of each layer as it builds the walls. With top and bottom gone and infill at zero, these perimeters are the only thing that will be printed.

This shows that starting with solid object has two advantages. Printing only the perimeters is very fast compared to zig-zagging infill moves, and I can adjust the thickness of the walls without changing the actual 3D model. This method is very effective and popular among those who print vase like objects.

The material used is ABS. It has high tendency to shrink when cooling and thus heated build platform is set to 115'C and the build chamber is heated to 70'C to prevent curling or cracking.

3. Print

This object is relatively big and took about two hours to complete. For slower machines the time could be near ten hours. Fast manufacturing also presents one of the obvious benefits of 3D printing; iteration. I started with three perimeter thick walls. This means the printer extrudes three loops in the shape of the object before moving up to the next layer. I started with thin walls just to test whether it was enough. In this case it was too flexible so I set the perimeter count to five. This produced a solid object with walls just the right size, but took near to five hours to finish.

Three perimeter walls were too flexible.

Five perimeters thick walls worked well.

Additional perimeters had to be removed after the print.

You may notice that the top was not actually open as you may have suspected. This is because it is not horizontal, and the strings closing the top are considered to be part of the wall by the slicer program. Removing these strings took less than a minute and was the only post-process needed.

4. The grill

I thought I should give a go at making a grill for the scoop as well. When designing it I chose to use the same trick used before and left the grill solid. This way I saved a lot of time not drawing the actual grill holes in the model and makes the density of the mesh adjustable.

Mesh and flange are adjusted with the slicer program.

Just like with the scoop I set the top and bottom infill to zero and outer perimeter thickness high. Only this time I set the infill to non-zero. This creates a nice mesh inside the perimeters normally intended to stiffen the object. The infill percent is completely parametric so again I can find a suitable value without actually doing anything to the simple 3D model. Spacing of about 5 mm was obtained with the infill set at 15%.

The flange in the grill would have been easy to model, but I chose to create it with the slicer program too. It is called skirt and is used to improve the prints adhesion to the bed. The width of the flange is also parametric when created with the skirt option.

5. Further developing

This was a one off project that I have no intention of continuing. However I am more than willing to help anyone with a similar project or print more scoops for people who are interested.

To mass produce this product one should make it a generic model that fit's more cars. Even if created for a car community in larger numbers (still less than 50) I would probably go with FDM methods.

Possible addition for brake cooling.

I also played with the idea of adding smaller scoops for brakes, but this turned out difficult as the original scoop was not designed this in mind.

Colorize - Electronic game in an afternoon

I attended an afternoon session at my uni called Electronics Crash Course. The session started with a generic step-by-step guide on how to blink an LED with a Teensyduino followed by 4.5 hours of ten work on an electronics game using basic components. The games were then presented to and tested by other students. Our team was one of six and had three members.

During this exercise we had to utilize:
- Programming with Arduino IDE
- Soldering and developing with electronics (Teensyduino)
- Prototyping (concept, design, build, test..)
- Time management

Concept and schedule

Having done PD6 exercises I had a realistic idea of what we could be able to establish during the time we had. Luckily I came up with the initial idea in a moment and we went with it so no time was spent on brainstorming.

The goal of our game is to match an led's color to another led thats color is randomized. The matching is done by adjusting the red, green and blue channels of the led that are driven with PWM. After the color is matched an indicating sound is played and a new color generated.

We had good ideas on how to improve the game throughout the process. Score calculation and timed rounds were the most likely ones to be implemented using 7-segment displays. However we valued the idea of a finished and functioning prototype more than an unfinished cluster of electronics that was too complicated to finish in time.


We proceeded effectively step by step. First generating the code and testing it to a point where we knew it would work as one of our team members hunted for all the components we would need. We also agreed on physical size and UI layout. After this we created a simple enclosure with plywood and coated it with vinyl as we had no time to paint it. Again ideas of additional features were flying back and forth, but we stayed in our plan; only after finishing the initial working prototype would we add more functionalities.

Assembly and soldering took a good portion of time in the end and at finish we only had about ten minutes remaining, which we used to decorate the project. This was with a careful time frame and expecting little setbacks, which we luckily did not experience.


Before the exhibition we had some time to test the game further ourselves and even collect some feedback from others. People seemed to like the game and only change we done was to swap places with the less for a more intuitive experience. After the exhibition all the games were free to test and a favorite was voted. This for my surprise was our team. Other teams showed good effort and ad created fun games as well.


This was a fun project from which I think we all learned. Being already acquainted with electronics I found the most rewarding our successful use of time. Also showing other team members what can be done with an Arduino in a short period of time was fun as I took the time to go through the basics and create an easily understandable code.

Our project doesn't end here as we plan to develop it further and leave it in public for people to use. We would also like to gather feedback and ideas from users that we could learn from and apply to later projects.

Wednesday, January 22, 2014

Shrinket, Arduino compatible ATtiny85 development board

Hackaday feature

If you are into electronics you have probably already heard of Trinket, Digispark or other similar product. They are all devices that provide Arduino compatible development platform in a small size and price. What they actually are is ATtiny85 microcontroller with USB compatible bootloader and some hardware connectors. When I first learned about these I was thrilled. Programming those chips can be very annoying when you have to detach them from the project every time.

I had been thinking of taking on an ATtiny based project but didn't come up with any ideas. After looking closer into these boards I figured building my own development platform would be a great project itself. I thought I could even beat the footprint size of Trinket and named the project Shrinket. I ended up building four.

Three Shrinkets, fourth is in a project.

Adafruit Trinket


I first examined the Trinkets schematics which are available here, and figured I already had everything I needed. Only exception was the voltage regulator, which I replaced with a 78L05 regulator. This means the board can't decide which power source to use, and I have to unplug auxiliary power when connecting to USB.

Note that in the drawing the wires under the chip shouldn't be crossing, as the D+ and D- are inverted!

Here is what I got out of those schematics. On the bottom you can see my first doodles of the component layout. I noticed the pinout on Trinket is the same as inverted ATtiny's, so I decided to use DIP-8 chip soldered to the bottom.


1x Perfboard - 0.6"x0.8"
1x Mini USB B SMD connector
1x Momentary switch - 4x4x1.5 mm SMD
2x 1x5 male pin header

1x ATtiny85 uC
2x Zener diode - 3.6V / 500mW SMD (doesn't have to be surface mount)
1x Diode 1N4002 SMD
1x 78L05 SMD regulator

Everything below SMD size 0805:
2x 10uF capacitor
2x 68 ohm resistor
1x 1.8 kohm resistor
2x 1 kohm resistor
2x leds

Also some jumper wire or through hole component leads.


Unfortunately I took no photos during the build, but I will add some if I ever build another Shrinket.

Here is a more detailed drawing of the layout:

I figured using a micro USB connector was the way to go and started by soldering one to a 15x20 mm protoboard. First I had to remove the copper rings from where the connectors pins where going to go since their spacing was completely off. I also removed the fifth NC pin from the connector to give more soldering space and pre-applied solder to remaining four pins.

The wires connected to USB connector should be soldered next as you will need all the space possible. I found the easiest way to do this was to run each wire through the nearest hole and bend it to touch the connectors pin. I then applied heat to the wire which then joined with the pin as the pre-applied solder melted. I saved ground wire last as it doesn't run to the other side.

As can be seen in the layout drawing there are two wires running under the chip. These had to be soldered before the ATtiny85. The mentioned wires are then connected to USB D+ and D- with 68R resistors. You have to be careful not to detach the wires from the USB connector when doing this.

Next I added the zener diodes to the D+ and D- wires on the bottom side and 1K5 resistor between D+ and +5 on the top.

ATtiny85 chip and button were next. I bent the chips legs outward to help connect the pin headers to them easier. Also note the 10uF capacitor between the switches ground and ATtiny's power pin.

Finally I added the LEDs and their 1K resistors, added the 78L05 regulator and 1N4002 diode to form the power supply. When I added the headers I also soldered a 10uF capacitor between the power running to the regulator and the ground pin. They are conveniently next to each other so the cap is easy to add together with the header.

Before doing anything else I ran a visual check and tried to power the board from safe USB power source. The power light came on and the chip didn't fry so I was confident to proceed to programming.

Putting the first Shrinket together took about 90 minutes. Three others I built took some 60 minutes each.


I decided to use the Trinket bootloader since it has good support and at the time I didn't have knowledge of any alternatives.

The bootloader is programmed with an Arduino. The complete instructions are here. First the Arduino is loaded with a special sketch and then connected to the board. I went ahead and built a simple shield to do this. This proved to be very convenient as it turns out it is very easy to brick the bootloader.

The programming took only few seconds as everything is included in the Arduino sketch. This means that the programming works even with the Arduino powered by a battery.

Uploading sketches

Sketches are uploaded with the Arduino IDE which has to be prepared for the Trinket bootloader. Adafruit has done a great job with this as well and you can even download an already modified version of the latest Arduino IDE here. In the program you also have to select the correct board from "Tools > Board" and change the programmer in "Tools > Programmer" to USBTinyISP.

With the bootloader and Arduino IDE ready it was time to upload first sketch. When the board is connected to a computer it flashes the secondary (not power) LED for about ten seconds during which the upload has to be started. If you miss this window you have to briefly press the reset button or reconnect the board. I found the latter more reliable. It has been pointed out that Trinket works better with USB 2.0 than 3.0, but I didn't experience any of the mentioned symptoms with my computer.

A simple blink sketch worked right away. However at this point I figured that whenever the board is powered by a computer it always delays start with that ten seconds waiting for a connection. This can be very frustrating in some applications.

Further testing

One of the benefits of virtual USB connection between the board and computer is the ability to emulate USB devices. This can be done with Adafruits library for this, but I found this to work better. From what I understand they both rely on V-USB project.

I tried some keyboard emulation with timed key presses and it worked well. This could be used in simple multimedia or game controllers.

What else..

This was a great project. I built a total of four Shrinkets, first two one at the time and two more at the same time. If you plan on taking this project I suggest building more than one like I did. You really understand the process better after each one and on something this small there's basically no room for mistakes. After a few it is possible to build several at the same time and probably reduce the build time significally.

You might wonder why I didn't just buy a few Trinkets or Digisparks since they are so cheap. I even found Trinket clones on ebay for under 5$! If you are like me, the build is usually more important than the final product. In this case it just happens to be a really cool Arduino compatible development board.

Tuesday, January 21, 2014

Electronic boost controller

This is a brief overview of a project I named EBC2013.

About a year ago I started working on one of my longer and more serious projects. Me and my dad share a project car which we like to take to the track. The car has a turbo charger installed and we wanted an electronic boost controller for it.  However there was a problem; they go for about ~250$ and up.. But how hard could it be to just build one?

First I set some goals for this project:
    - Electronics are controlled by Arduino microcontroller platform
    - Finished looks
    - Intuitive and simple user interface
    - Open and closed loop modes for boost control
    - Over boost protection / boost cut
    - < 100$ budget

I started by doing some research since I had no experience on electronic boost controllers (EBC). I read through couple user manuals to get an idea of what features they might have. This also gave me a rough idea on how I wanted the GUI to operate. I also gained an understanding for how the device as a while should work. Basically it has a pressure sensor that monitors the MAP (manifold air pressure) in the engine and drives a solenoid with a varying PWM signal. The solenoid opens and closes the air to a pneumatic actuator on the waste gate of the turbo charger thus controlling the boost. For a better explanation please turn to google, as it could be a blog post on itself.


Inspired by an off the shelf controller I decided to use only three 7-segment displays and two push buttons for the interface. This would provide some challenge in communication, but benefit from compact size. The user would shift up and down menus with the two buttons and proceed by pressing both buttons simultaneously. The menus can be thought as trees that have branches, but at the end the interface always returns to main screen.

Here's a video showing an early experiment with the menus and closed loop control. The potentiometer simulates the MAP sensor.

The code

Before I received any of the parts for this build I had time to work on the code. It quickly expanded to over 1000 lines, which is by far the longest single program I had ever written. When I finally had the chance to burn the program to the finished hardware it had only minor tweaking left.

The commented code is available here: EBC2013. I am more than happy to help if some part is hard to understand. Also NOTE that the PID closed loop control portion is highly experimental!


The EBC consists of two parts; the main unit located near the driver and the solenoid located near the engine. The main unit can be separated to eight blocks.
     - The Arduino Nano; controls and is connected to everything
     - Voltage regulator, everything works with 5V except the solenoid
     - MAP sensor, MPX4250AP
     - The display and push buttons
     - Chips driving the display, 3x TPIC6B595
     - Buzzer speaker
     - FET driving the solenoid, IRLZ44N
     - Connector for power, solenoid and possible auxiliary accessories

All of these are distinguishable in the final circuit board:

Those heatsinks are probably unnecessary, but I didn't want to take any chances as the case is not ventilated.

I would like to point out that I had no previous experience in using 7-segment displays or shift registers, but didn't want to use existing libraries. Each display is driven by its own high power TPIC6B595 shift register and all the digits in the code are created by me painstakingly slow one by one. In the end this was very rewarding as I had the chance to design my own letters and figure out which symbols are possible and which are not. I wrote brief instructions on how to add more symbols to the code.

With the layout I wen't after simplicity as well as robust design. The hardware has to work reliably and withstand shocks and vibration.

The Case

The circuit board was created to fit an aluminum case that has mounting grooves for it. When I received the case I was happy to find the dimension given by the seller correct and the board fit perfectly.

In this photo the hole for the 8-pin connector was not yet cut.

Further development

After finishing this build I started to play around with an idea of manufactured PCB. I also changed the Arduino nano to embedded ATMega328 chip and replaced the three shift registers with a single smd MAX7219 chip that can handle up to eight seven segment displays and already has a good Arduino library written for it. The Eagle files for the layout and schematics can be found in the github repository here. I apologize that I don't have an updated code for this board, but I never got around ordering any. The schematic will however help to build your own controller.

Testing and conclusion

Installing the EBC was straight forward. I mounted the device under the dash with velcro and ran wires to switched power and to the solenoid. The pressure line I spliced from the ECU with an Y-connector.

First test I did was with open loop mode, in which the controller feeds the solenoid with a constant predetermined PWM signal that can be changed in the menu on the go. This was simple and worked like expected, but the closed loop was tricky and showed severe hysteresis. Later I tried PID control. It was easy to implement but very hard to tune. (This was not helped by a jamming wastegate that went unnoticed for quite a while.)

I put the closed loop development to a halt, as it was taking way too much time, but showing very little results. After all the open loop mode works reliably and is fast and easy to alter while driving. I also hit every other goal on my initial list.

I have added all sorts of little tweaks on the way like display brightness, maximum detected boost, atmospheric pressure compensation and "added boost" mode in which the driver can momentarily raise the boost limit with a press of an auxiliary button.

I am very happy with the EBC at the moment, and don't regret going DIY. After all this is a product designed by me for me and open for me to change anything if ever needed.

For those who are interested here is a picture of the engine bay. The solenoid can be seen right above the air filter, installed away from the heat.