Project showcase
Magnetic Stirrer

Magnetic Stirrer

Develop a strong magnetic stirrer for the price of an entry level magnetic stirrer.

  • 3,491 views
  • 7 comments
  • 9 respects

Components and supplies

Ardgen mega
Arduino Mega 2560 & Genuino Mega 2560
×1
Fairchild semiconductor pn2222abu. image
General Purpose Transistor NPN
I used Tip 31A NPN. This is used to turn on the PC fan using a PWM signal.
×1
09939 01
Rotary potentiometer (generic)
I used a 5k Ohm pot. This is used as the speed control signal being read by arduino ADC A0
×1
120 AC to 12 Vdc 2amp wall converter
This is to power the 12 Vdc PC fan.
×1
12 Vdc PC fan size: 80mm
I bought cheap Chinese ones from amazon.com. they are crap. Buy a nice fan.
×1
Neodymium Rare-Earth Magnets (size: about the size of dime and about 0.25 in thick
this is part of what makes the stirrer stronger. The stronger the magnets the less likely stirrer will throw stir bar. The stronger the magnets the more load will be placed on the motor. I used 2 and I was very impressed.
×2

Necessary tools and machines

Multimeter

Apps and online services

Ide web
Arduino Web Editor
I combined the "fade" and "ReadAnalogVoltage" example programs to make the code. Hence the code is really simple.

About this project

I bought my first magnetic stirrer to help improve my mushroom liquid cultures. After seeing how much the constant stirring improved the culture, I decided I wanted more of them. After reading a few articles about the magnetic stirrers, I found that I could use an Arduino as the control signal (PWM) to drive PC fans and make a batch of magnetic stirrers for about the same price as one entry level stirrer.

Code

Magnetic StirrerArduino
/*
 Magnetic Stirrer
 
 Layman summary: 
 We will use a potiometer to control the speed of a DC motor.
 When the potiometer is turned to full Ohms then the motor should stop.
 When the potiometer is turned to 0 Ohms then the motor should be running full speed.
 And if the potiometer is somewhere in the middle then the motor speed will follow. 
 
 
 InDepth summary;
 This code will read an analog voltage of the potiometer using pin(A0). 
  We will take the analog to digital conversion (ADC) value and 
 produce a corresponding PWM signal on pin(9). The PWM signal will turn the 
 NPN transistor on/off very quickly to the point where the motor will spin like
 it is getting less than full power. 
 
 Notes:
 1. Please note the ADC on the Arduino mega is 10 bits. The PWM is 8 bits. 
 So we need to divide the ADC value from pin(A0) by 4 and then send that value to 
 the PWM on pin(9).  
 
 2. Intersting to note that if you leave out the division then 
 you will notice that a 1/4 turn of the potiometer will give you a 0 rpm to full speed 
 on your motor. This is because 8 bits will get you 255 steps for the PWM and the 
 ADC 10 bits will give you 1023 steps. 1023/255 = 4 (roughly) 
 
 3. I added a delay at end of loop to help stablize motor speed. I noticed
 with PC fans I was using that if you rotated the potiometere quickly or back and fourth
 that the load of the magnets and the drastic speed up/down would burn out the 
 cheap PC fan motors. So a word of caution is to turn the pot slowly to avoid motor burn out :)
 
 
 Brief Function description: 
 analogWrite() allows us to send a 0 to 255 value to a PWM pin. 
 ReadAnalogVoltage() allows us to read a 0 to 5Vdc voltage and convert
 voltage into a value between 0 to 1023. 
 Serial.Began starts serial communication to "Serial Monitor" 
 Serial.PrintLn writes one line to "Serial Monitor"


 Credits:
 Giving credit to the contributors of the example (basic) "Fade" program 
 and "ReadingAnalogVoltage" program since this code is really just a cut/paste of 
 both example programs into one working code.
 
 
 leaving the original ReadAnalogVoltage notes since I found them useful as well :) 
   ReadAnalogVoltage
  Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.
  Graphical representation is available using serial plotter (Tools > Serial Plotter menu)
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

  This example code is in the public domain.
 */


int motor1 = 9;           // the PWM pin 
int motor1speed = 0;    // how fast motor1 is

// the setup routine runs once when you press reset:
void setup() {
  // declare pin 9 to be an output:
  pinMode(motor1, OUTPUT);
    // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  
      // read the input on analog pin 0:
  int motor1speed = analogRead(A0);
  
    // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 12V):
  float voltage = motor1speed * (12.0 / 1023.0);
  
  // print out the value you read:
  Serial.println(motor1speed);
  // print out the voltage 
  Serial.println(voltage);
  
  // set the motor1speed of pin 9:
  analogWrite(motor1, motor1speed/4);
  
  // delay 30 miliseconds. this pre
  delay(30);
}
Magnetic Stirrer Rev 3
This is rev 3 of the code. There was issues with motor response at slow rpms. So I improved the code by making the PWM frequency proportional to the motor rpm.

Schematics

magnetic_stirrer_bb_2NYTYwdNCa.png
Magnetic stirrer bb 2nytywdnca

Comments

Similar projects you might like

The Magnetic Field and RGB Tester

Project tutorial by Kutluhan Aktar

  • 3,610 views
  • 0 comments
  • 14 respects

Magnetic Levitation

Project showcase by Hao Jie Chan

  • 34,205 views
  • 66 comments
  • 71 respects

Arduino - Magnetic Reed Switch KY-021

Project showcase by Danny van den Brande

  • 3,763 views
  • 0 comments
  • 0 respects

DIY Magnetic Table Hockey With RGB Lights and Sensors

Project tutorial by evive

  • 3,320 views
  • 0 comments
  • 19 respects

Home Plant Watering System

Project tutorial by Alexander

  • 15,563 views
  • 2 comments
  • 45 respects

Box with rfid-reader and electro magnetic lock

Project showcase by Pär Stigenberg

  • 5,727 views
  • 0 comments
  • 14 respects
Add projectSign up / Login