Tag Archives: 4delta

4 Delta + A-Star Mini: Learn how to 3D print.

Today I’m building a light for my bike’s wheel. This light will be attached to the wheel and will shine on and off as the wheel spins in order to create a stand still image.

cuore2.gif

Usually I build things just buying electronics and putting them together, but for this one I need an extra step, design and fabrication of a plastic box to attach the light to the wheel. Because of this extra step, I though this was a nice opportunity to try 4 Delta 3D printing training course.

4delta

Although I have used 3D printing before (see for instance my light stand or how I fixed an old game), I lack most of the good practice in 3D printing knowledge, and the 4 Delta course covers that perfectly.

The course is completely on-line with videos and e-books. It took me about one week working only half an hour or less everyday. Within the course, you learn how to properly design pieces, the materials available, how to set-up your 3D printer, common design mistakes, how to export models, printing errors… and you get access to Onshape (CAD software that runs on your browser). And if it was not enough, for your cash… you get permanent access to the new 4 Delta forum where you can ask and solve questions about DIY 3D printing. Resuming, it is a very good investment in yourself and your future projects.

So… I took the course and used Onshape to design my box.

019

It was composed of 3 parts.

018

And it includes holes for attaching the parts together with screws.

017

The idea is that the last piece and the middle one will grip on the wheel radios fixing the box in place. However, although this design is made in order to make 3D printing easy, it has some defects that can be improved. For instance, walls of the middle part are too thick and don’t include wholes for connecting USB, there is no holes for attaching the lights or the electronics, the box should be able to attach/detach from the bike without having to open them completely (this feature will need a major review), and there is no mounting for the Hall sensor that will determine the angular position.

However, for a Mark 1 model the design is good enough and this is how it looks like once 3D printed (I used 4Delta printers through the 3D HUBS).

IMAG4696.jpg

and this how it goes on my bike (I have a stand to workout at home during winter).

IMAG4697

Now lets go for the electronics.

Recently I have used a very nice A-Star micro board (because it is extremely tiny). For this project I will be used the bigger version, the A-Star micro. Why going for the A-Star instead of one of the more common and better supported Arduino boards? My main reason is because they do the A-Star micro and hell, that board is really tinny. By using more boards from the same company, I will be able to learn more and improve my designs even further.

This is my shopping list in Coolcomponents:

transbluecoolcomplogo4

The circuit diagram for this set-up is quite simple. Note: If using more NeoPixel sticks, they can be attached in series one after the other.

A-Star Mini

The circuit diagram is a battery attached to a micro-USB for charging. The output of the battery is attached to an interrupter which output goes to the voltage regulator. The voltage regulator powers the A-Star. The A-Star powers both the Hall sensor and the NeoPixel LED strip. The output of the Hall sensor is connected to the analogue pin A5 (pin 23) and the input of the NeoPixel is attached to pin 6.

Now lets go for the code, but before explaining the code, 2 things. The first one is that in order to run the NeoPixel, you need to download the zip file with the libraries and install it in the Arduino IDE (simply Sketch>Include Library>Add .ZIP Library). The second thing is about how to draw things. For my example I’m going to use a red heart. The idea is that the shape we want to draw is divided into columns, each one of 8 rows. As the wheel spins the LEDs will cycle through the columns. So we can turn our draw into an array and know exactly which pixel has to be on and when. In addition, as the NeoPixel LEDs are numbered we need to convert the array into a vector and cycle through the vector.

A-Star Mini cuore

Keeping this in mind, this is the code I prepared. Basically, it reads the Hall sensor and when the signal from the sensor deviates from the average it means the sensor has passed over the magnet and a turn of the wheel has happened. With this trick we can measure the period of a revolution and hence synchronize the lighting of LEDs. The next thing that the code does is light the LEDs according tot he pattern (see heart shaped pattern above), the time it takes to jump from one step to another depends on the speed of the wheel (right now it is set to take about 1 degree).

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define PIN            6

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS      8
//This is to define the shape we want to draw (Note: monocolor at the moment).
int pixi[] = {0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0};
//This defines the number of steps it takes to draw the full image
int numsteps = 7;

//This is to measure position using the Hall sensor
#define numReadings 20
float readings[numReadings];
float sensorval;
float average = 0;
int start;
int finished;

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pixels.begin(); // This initializes the NeoPixel library.
  start = millis(); //This initialices the function to meassure the wheel speed.
}

void loop() {
//Hall sensor is attached to pin 23
//We read the output each iteration (Powering the sensor with 5V the output is 2.5V at zero magnetic field and 0V/5V at negaqtive/positive saturation.
//At the moment we don't need to convert the reading from 1024 bits into a real voltage reading.
  sensorval = analogRead(23);
//We keep the last 20 values in memory by sifting values in an array
//and simply deleting the oldest one and adding the new one at the beguining
//To save time the average is calculated at the same time
  average = readings[numReadings-1];
  for (int k = 1; k < numReadings; k++)   {     readings[numReadings - k] = readings[numReadings - 1 - k];     average = average + readings[numReadings - k];   }   average = average / numReadings;   readings[0] = sensorval;   //Now, if the new reading deviates too much from the average (standard deviation can be calculated,    //but symply by using a fixed interval works fine), then it means the wheel has completed a cycle and it is time to draw again the symbol.   //We can use the elapsed time to calculate the spinning speed. //An artificial delay can be included here to select in which part of the cycle we want to draw.   if (sensorval > average + 20 or sensorval < average - 20)
  {
    finished = millis();
float milisperangle = abs(finished - start) / 360;
start = millis();
delay(milisperangle*8);
draw(3*milisperangle); 
  }
}

void draw(int delayval)
{
  //This function takes numteps x delayval (ms) to execute
  //For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
  for (int j = 0; j < numsteps; j++) {
    for (int i = 0; i < NUMPIXELS; i++) {
      // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
      //Now we only use red color
      pixels.setPixelColor(i, pixels.Color(255 * pixi[i + j * NUMPIXELS], 0, 0)); // Moderately bright green color.
    }
    pixels.show(); // This sends the updated pixel color to the hardware.
    delay(delayval); // Delay for a period of time (in milliseconds).
  }
}

Remember that depending on which side of the wheel you place the lights the spinning is the same as you write or the opposite and you need to change the steps accordingly.

The next step is placing the components inside of the box (I added some extra wholes). Some of the wholes could have been done in the designing part, but I didn’t though too much in the final details, also, some of the wholes is better to do them afterwards in order to have a good print.

DSCF0009.JPG

The battery goes on top and the box closes gripping to the wheel.

As I said, I didn’t include a support for the Hall sensor, so I added a last-minute solution which also allows me to change the distance between the sensor and the magnet (the thing close to the sensor in the next picture).

IMAG4868_BURST002_COVER

And Voilá!

cuore2

That’s all!

.

.

.

.

.

.

.

Ok ok. Here it is, a tribute to 4 Delta for their help with the training and the 3D printing…

.

.

.

.

.

.

Want even more?!

As an extra, here it is a close look at the NeoPixels.

DSCF0007

Hope you like it!

Advertisements

3D light stand

The next project is building a stand with a mirror and lights to display figures, models and whatever looks cool on it. It is not aimed to be a tutorial. For a 3D printing tutorial visit my post about 3D printing.

I had a circular mirror, and my idea was to build a base for it which could hold some LEDs inside to add lights to the project. So I started by making a 3D model of the base with Blender.

base

Next step, using the service provided by 3D Hubs, I printed the base through my favourite printing company 4Delta.

baseThis time I could take some pictures while the base was being fabricated.

Once finished, I check the size and it fitted perfectly with my mirror.

IMAG3703

For the lights I choose to use common LEDs (drain about 2V and 10mA) and I’ll be powering them in parallel through the USB (5V). In order to limit the current delivered by the USB, I added a 240 Ohm resistor to each LED. This configuration will power each LED at the correct voltage and provide about 12 mA per LED. By the way taking into account that this USB can provide up to 1A, then I can power 100 LEDs, so there is no problem powering up my 8 LEDs.

The next step is putting everything together. Ideally I will use SUGRU to glue the parts, but for now I will only use Blu-Tack which can be easily removed. I will use SUGRU later own to make it permanent if I’m happy with the design.

With this, the project is finished and ready to display figures.

IMAG3735 IMAG3752 IMAG3756

3D printing with 4Delta through 3DHub

I know 3D printing is a hot topic… and as many other people, I also would like to have my own 3D printer. However, thanks to collaborative effort there is a new trending which consist in ordering the parts to local 3D printers instead of printing them yourself.

That’s basically what the web-page 3DHubs does. If you want to print any part cheap and fast but you don’t have a 3D printer…. maybe someone near you can do it for you and sell you his services.

logoIn order to show you how this whole business works, I have a nice project: building a cap for the battery holder of an old video game (which I lost many years ago).

path5263

Note that flames are not real.

So, first thing, a quick draft of what we want to do. Basically one cylinder for the top, one cylinder to go inside and hold the battery in place, and 2 side wings to hold the cap in position. Something roughly like this.

IMAG3198

Now it is time to make the 3D design.

Due to AutoCAD popularity, usually the 3D models are refereed as CAD files, but there is many formats and programs for editing. What is important, is to convert the files to *.stl format, as it is the standard format people on 3D printing are using.

So, for this project I choose a professional open-source software called Blender (and in addition, I refresh my skills with Blender).

index

Blender is quite easy to use, and there is lots of tutorials and videos. So, I leave to you learning the basics. Just remember a very useful tool (the wrench icon) Modifier>>Add Modifier>>Boolean. This allow you to perform operations as intersection, union…which have infinite applications.

In my case, the design is quite easy. The only problem I found is that I couldn’t specify space units in Blender, hence I’m not sure which size my design will be. Anyway, this is how it looks like.

battery

(By the way, if you don’t want to make a design, maybe you can find what you need on-line in pages like Instructables or thingiverse… there is a useful compilation in the 3DHub links).

After a few tries, I solve the space problem by setting that 0.5 inside the program scale corresponds to 1 mm in the final *.stl file.

battery_size

Almost forget. For some reason, which I don’t know yet, before exporting, you need to select all. Then simply export with default options.

battery_size_save

At this point, if you want to double check, an easy options is an online *.stl viewer like viewstl.

stlviewer

Now everything is ready for printing. Let’s go back to 3DHubs and load the model. Click on 3D Print (1) and then load your file (2).

003

You can check the size (4) and select the scale of the file (3).

Now it is time to select the printer. Normally you will choose a printer nearby and simply pick the object once finished. In the London area it is not a problem to choose printer, there is lots and lots… however, I’m choosing one in particular, 4Delta.

4delta

I choose 4Delta because 4Delta is a start-up about 3D printing which aims to develop 3D printing and create training courses for companies, schools, universities and home users. On top of that, the guy behind this project is my friend and we use to work for the same institution.

Just to mention that they offer printing services as a way of maintain their printers busy, their main activity at the moment is training. If you are interested, I recommend visiting their official webpage.

Going back to the printing. I select 4Delta as printer. I choose to fabricate 8, in PLA material (standard).

005

As you can see, the price is very low. In fact, 4Delta is offering the cheapest prices in the London area in order to get more projects and gain experience in the problems that people face when approaching 3D printing.

So, now that the order is placed what? Well, first of all, there is emails reporting every step on the process, and of course, you can check it online.

009

Be advise that the people doing the printing have a limited amount of time to accept the order, otherwise it will be redirected to another printer. I tell you this because if you place the order during weekends or midnigth you may ended having it done by a different printer.

Next step is paying, which can be easily done by debit card… and waitting for the job to be done.

In my case, I just pick it from my friend, which also gave me some advises for next design. For instance, the lateral wings need to have some type of support. But in any case, you can see that the job was done perfectly and it fits.

path3061

Finally, thanks to 3D printing, this old game works again!

path523463