Arduino Microcontrollers

Started by Allcanadian, 2013.03.06, 06:39:54

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Allcanadian

I was in the middle of a project last night and needed a breather so I displayed out favorite logo,lol. I also found a neat picture hidden deep in the bowels of my project archives, Oh the memories :). This was one of my first magnetic levitation experiments and I was measuring instabilities with a laser. I learned that the magnetic field was most definitely not uniform on the microscopic scale and induced instability on rotation.
It's too bad we cannot post video's because I have some very interesting ones concerning levitation. There is just something about it which boggles the mind, it is easy to understand why it works but it is still just very bizarre to see it up close.

AC
Comprehend and Copy Nature... Viktor Schauberger

"The first principle is that you must not fool yourself and you are the easiest person to fool."― Richard P. Feynman

giantkiller


Allcanadian

Here is a basic opto-isolated buck converter circuit I whipped up in Fritzing, awesome open source software.

The circuit can drive any N channel Mosfet with the 7667 Mosfet driver in pretty much any application and is normally in the off state until the Arduino pin 6 goes HIGH. I will write up the code for manual timing through the Arduino interface, PWM using a simple 10K trimmer pot and PWM through a GUI so we can move a slider with our mouse on our computer desktop.

AC
Comprehend and Copy Nature... Viktor Schauberger

"The first principle is that you must not fool yourself and you are the easiest person to fool."― Richard P. Feynman

Allcanadian

Manual timing for circuit


int led1Pin=6;

void setup()  {
  pinMode(led1Pin, OUTPUT);// set pin 6 as output
   
}

void loop()  {
   
 
  digitalWrite(led1Pin, HIGH);  // turn ON
  delay(10);  // delay 10 milliseconds                 
  digitalWrite(led1Pin, LOW);  // turn OFF   
  delay(10);  // delay 10 milliseconds
 
}


// delay(10) is in milliseconds, 1000ms= 1 second
// for smaller delay use  delayMicroseconds(10);   instead of   delay(10);
//   1000 microseconds= 1 millisecond
//equal ON/OFF delay equals 50% duty cycle
Comprehend and Copy Nature... Viktor Schauberger

"The first principle is that you must not fool yourself and you are the easiest person to fool."― Richard P. Feynman

Allcanadian

In this mod the 10K external pot controls the duty cycle of the mosfet, the frequency is about 500Hz and duty cycle varies.




int ledPin = 6;      // output on digital pin 6
int analogPin = 0;   // potentiometer connected to analog pin 0
int val = 0;         // variable to store the read value

void setup()
{
  pinMode(ledPin, OUTPUT);   // sets the pin as output
}

void loop()
{
  val = analogRead(analogPin);   // read the analog input pin 0

  analogWrite(ledPin, val / 4); 
  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
Comprehend and Copy Nature... Viktor Schauberger

"The first principle is that you must not fool yourself and you are the easiest person to fool."― Richard P. Feynman

TinMan

@AC
Well it all looks simple enough.
Thanks for taking the time to do this.
Do you have some video of this setup driving a load?, would be good to see it up and running.
Never let your schooling get in the way of your education.

Allcanadian

@tinman
QuoteWell it all looks simple enough.

There is not much to it and it helps if a person can connect the dots. Some might think a regulated power supply is beyond their skill level however think nothing of building a 30A DC motor driver when in fact there is little difference between them. I threw in a 15000uF/63v DC capacitor across the output and this circuit ran a bank of 20 1/2 watt LED's near ripple free.

One issue is that in PWM mode the max frequency is 500Hz however in manual timing mode the frequency can be much higher so I will write some code to tweak it. analogWrite is PWM mode and digitalWrite configures the pin manually so it is simply a matter of creating a variable delay from microseconds to milliseconds.

The thing to remember here is that almost all the changes occur not in the circuit but in the code so any changes are super easy and can be done on the fly.

AC



Comprehend and Copy Nature... Viktor Schauberger

"The first principle is that you must not fool yourself and you are the easiest person to fool."― Richard P. Feynman