I love physics jokes.
http://xkcd.com/45/
Monday, November 30, 2009
Wednesday, October 28, 2009
Plausible Deniability
I have no idea if his political opinions are at all useful, helpful or realistic, but you have to admire the governator's style.
http://www.boingboing.net/2009/10/28/arnold-schwarzenegge.html
http://www.boingboing.net/2009/10/28/arnold-schwarzenegge.html
Monday, October 19, 2009
Motor Turns
The motor is turning, have gone through program and am starting to remember what it was I was trying to do. Next step will be too pack everything up as I am moving at the end of the month. I will however have some time to work on the program.
Woot.
Woot.
Sunday, October 18, 2009
Progress
Thursday, October 15, 2009
Vegas knows how to take your money
Last night I went to find dinner. I found a little chinese noodle shop, ordered a beef brisket noodle soup and an order of gai-lan. Bill - $38. Same dish at Taiwan Beef Noodle house (I think it is now called Wang's) on Granville in Vancouver - $14.
On the plus side, there didn't seem to be too much MSG as my dreams were fairly normal, at least for me. You know, motors, lithium batteries, blinking LEDs. Good dreams.
On the plus side, there didn't seem to be too much MSG as my dreams were fairly normal, at least for me. You know, motors, lithium batteries, blinking LEDs. Good dreams.
Tuesday, October 13, 2009
Have to wait until the weekend.
I'll be out of town all week, so there will not be any progress until the weekend, but I did pick up all the bits to populate the cards today. Progress should be pretty quick when I get back.
Monday, October 12, 2009
Double sided card done
The challenge I ran into was I had made a double sided design that really requires good alignment, and also had not aligned full spectrums template exactly square. So I redesigned the board to minimize the top layer and be forgiving to misalignment, and very carefully realigned the template. I believe this will be functional.
- Posted using BlogPress from my iPhone
- Posted using BlogPress from my iPhone
Sunday, October 11, 2009
Friday, October 9, 2009
follow up
So the double sided input card didn't work the first time. I guess I installed the stencil slightly off square which didn't impact the single sided cards, but made the double sided card goobered. I probably wont have time to try again until next week.
Wednesday, October 7, 2009
Progress
Here are the designs for the cards I am making.
The first I call "Input" which has some protection for the 15V inputs for the Concept Card. This will be the hardest to make as it is two sided and may be difficult to line up. I haven't made this yet.
The next image is "Switch" which takes the 5v from the sanguino and switches it to 15V and also takes the 15v status signal from the concept and knocks it down to 5V. I made this last night, and it turned out pretty good.
On both these cards I tried to keep the power rails on the outside and signal wires in the middle. Hopefully they will be pretty robust from a noise perspective.
The picture on the previous post was "Output" which takes the output from the Concept Card and interfaces to the IGBT's.
I also need to make a 10-15V input to 15V output regulated power supply for up to 20 amps, but this can wait for now as I have an old mac power supply kluged with a 7815 dangling from my desk.
If anyone is wondering, I'm using the free version of Eagle 5.6 for layout, and the reason I did three cards is I am limited to 2.5 by 3.5 inches on the PCB because that is all that will fit through the epson printer in the CD tray.
Monday, October 5, 2009
first succesful inkjet printed PCB
I bought a kit from Full Spectrum Engineering to do PCB's direct from an Epson R280. The first two didn't turn out very well, but the third worked okay.The trick was to print it 3 times, not the 2 that the instructions say, cooking the ink each time and being Very careful when re-aligning the circuit board.
I think the double sided boards are going to be very tough.
Wednesday, September 30, 2009
gap, but back at it
I ran into a wall a few months ago working on the inverter. My circuit to fire the IGBT's was just not working, and I couldn't figure out why. I've since tossed my own own design, got some commercial firing cards (Concept Scale Drivers) and designed some PCB's to interface the firing card to the sanguino.
I'll post some pics when I get the PCB's etched and built.
I'll post some pics when I get the PCB's etched and built.
Friday, September 25, 2009
Quote I like from Tom Ligon from the talk Poywell forum
Regarding profit, here's the really neat thing. Yes, the reason power companies want to produce power is to sell it and make a profit. The bean-counters have job security, and the engineering economists can calculate the depreciation on capital investment and life cycle costs and all that, enabling the power companies to extract a viable margin.
But that's not the real profit, and we all know it, and it is why we're all concerned about energy. The profit is that the electricity made is worth far more than it sells for. If we cannot get it by other means, we'll spend the money on solar to get it because it will be worth it.
The profit is what you can do with energy, especially abundant energy with fewer negatives involved in getting it, and what the fruits of those expenditures are. Energy, with raw materials and human talent, are the basis for our economy, and so is priceless.
The economics will shake out the most economical way to produce the power we need, but they don't set the value of the power to civilization.
But that's not the real profit, and we all know it, and it is why we're all concerned about energy. The profit is that the electricity made is worth far more than it sells for. If we cannot get it by other means, we'll spend the money on solar to get it because it will be worth it.
The profit is what you can do with energy, especially abundant energy with fewer negatives involved in getting it, and what the fruits of those expenditures are. Energy, with raw materials and human talent, are the basis for our economy, and so is priceless.
The economics will shake out the most economical way to produce the power we need, but they don't set the value of the power to civilization.
Tuesday, August 18, 2009
Friday, August 7, 2009
Not sure if this is real...
Russian Women's prison..... has a beauty pagent.
http://www.webpark.ru/comment/52940
Is this real or the plot for a bad porno from 1982?
http://www.webpark.ru/comment/52940
Is this real or the plot for a bad porno from 1982?
Thursday, August 6, 2009
Monday, July 27, 2009
Totally Knackered
Had a busy weekend. I irresponsibly purchased two lathes, a drill press, a metal saw, and a lifetime supply of bits of metal. We moved the last (and larger) lathe yesterday with the help of good friend John. This guy's strength never ceases to amaze me.
"No, don't worry. I can totally lift it."
Also did a bunch of wiring at my parents cabin. My hands are very sore from bending 4 gauge teck in electrical panels.
Little to no progress on electric car as I simply have been ignoring it as I walk most places these days.
Soon I'll get back to it.
"No, don't worry. I can totally lift it."
Also did a bunch of wiring at my parents cabin. My hands are very sore from bending 4 gauge teck in electrical panels.
Little to no progress on electric car as I simply have been ignoring it as I walk most places these days.
Soon I'll get back to it.
Tuesday, June 30, 2009
Lawful Access
Please listen to this podcast.
I did, and sent the following letter to Minister Van Loan.
You have not struck the right balance. You have listened too much to the Police. You say you have consulted with industry. Which industries? Rogers? Bell? Telus? they are not innovators. They are not the new economy. Please talk to internet entrepreneurs. They are much more in touch with reality.
Your party was elected to protect individuals, not centralize government authority and power.
I listened to your interview on search engine. It is clear you are woefully out of touch with reality. If I could offer you a bit of advice, fire the staffer that briefed you for that interview. Even if you have no idea what you are talking about, you need to be able to fake it.
Jake Gray
I did, and sent the following letter to Minister Van Loan.
You have not struck the right balance. You have listened too much to the Police. You say you have consulted with industry. Which industries? Rogers? Bell? Telus? they are not innovators. They are not the new economy. Please talk to internet entrepreneurs. They are much more in touch with reality.
Your party was elected to protect individuals, not centralize government authority and power.
I listened to your interview on search engine. It is clear you are woefully out of touch with reality. If I could offer you a bit of advice, fire the staffer that briefed you for that interview. Even if you have no idea what you are talking about, you need to be able to fake it.
Jake Gray
Tuesday, March 10, 2009
Update
Friday, February 27, 2009
Challenges firing an IGBT
So it turns out firing an IGBT is a little more complicated than I thought. It turns out the gate acts like a capacitor, so if you charge it with a positive voltage to turn on the transistor, it stays on unless you put a negative charge on it to turn it off.
I've found an integrated circuit from fairchild semiconductor, the FOD3180, which does this as well as using an opto isolator. I've ordered a few from Arrow electronics as I couldn't find a local supplier.
more to follow
I've found an integrated circuit from fairchild semiconductor, the FOD3180, which does this as well as using an opto isolator. I've ordered a few from Arrow electronics as I couldn't find a local supplier.
more to follow
Friday, February 6, 2009
Updated Photo
So here is the test VFD is it sits today. Sanguino is working generating a PWM 3 phase sin output to the firing cards. I have a 12v supply which is powering everything at the moment. I need to pick up some wire to hook the firing cards to the IGBTs, kluge some power to apply to the IGBTs, and then some big resistors or light bulbs or something to pump power through. I've found some help in locating a suitable vehicle and motors. Updates soon.
Monday, February 2, 2009
Setup of controller
Thursday, January 29, 2009
New arrival
Two PWM driver cards from the Reprap store arrived a couple days ago. I should have a chance to solder them up tonight and see if they do the trick. Now I just need a motor to play with.
Monday, January 26, 2009
Encoder has arrived
I purchased a BEI encoder from ebay a while ago and now have it in my hot hands. I intend to attach it to whatever motor I use as velocity feedback. That should allow me to create some sort of vector control for the motor. I've been reading a lot, but I am still unsure how the math works, but at least I think I know what the pieces are.
angular velocity of the rotating magnetic field, or frequency of the output (I can control this)
total voltage (I can control this)
output current (I can measure this)
speed difference between magnetic field and rotor, also called slip (I can measure this)
My thoughts are that the gas pedal will be attached to a pot that will essentially be a torque request. The controller will always output a frequency a bit faster than the moving speed of the rotor based on the motors slip. Based on the torque request, the voltage will be changed to get the requested current.
We'll see. Now I just need a few hundred volts dc and a motor to try it on.
angular velocity of the rotating magnetic field, or frequency of the output (I can control this)
total voltage (I can control this)
output current (I can measure this)
speed difference between magnetic field and rotor, also called slip (I can measure this)
My thoughts are that the gas pedal will be attached to a pot that will essentially be a torque request. The controller will always output a frequency a bit faster than the moving speed of the rotor based on the motors slip. Based on the torque request, the voltage will be changed to get the requested current.
We'll see. Now I just need a few hundred volts dc and a motor to try it on.
Friday, January 23, 2009
Working!
My sanguino program is working quite well now. I used direct control of timer0 and direct port access on port C to get pwm of 6 normal outputs.I ran into a problem of not being able to generate a fast enough frequency, so I had to reduce the resolution of my sin wave array from a value every 2 degrees to every 6 degrees. I think this should still be fine for motor control, it just may produce some wicked harmonics. I'm still waiting for an encoder I bought off ebay, and two firing cards from the Reprap store.
Next step is to find a small three phase motor, some sort of shunt for measuring the current and start getting things to spin. Woot!
Next step is to find a small three phase motor, some sort of shunt for measuring the current and start getting things to spin. Woot!
Wednesday, January 21, 2009
Commissioned Art
Latest code
I've managed to generate the three phase sin wave output without using analog write commands or any delay functions. It uses some lower level commands within the Arduino programming environment.
It works to speed up and slow down the phases, but I haven't been able to control the maximum voltage yet. I think I'm running into a problem of the interrupt service routine being too long.
Cheers.
// this will be an attempt to change how the pwm is done, and use interupts and direct port access with a higher speed
// port C > 7= pin 23
// port C > 6= pin 22
// port C > 5= pin 21
// port C > 4= pin 20
// port C > 3= pin 19
// port C > 2= pin 18
// port C > 1= pin 17
// port C > 0= pin 16
#include
#include
ISR(TIMER0_COMPA_vect) {
callback();
}
boolean ledpin_1 = 1; // 0 or 1 for if the 1st led should be on
boolean ledpin_2 = 1; // 0 or 1 for if the 2nd led should be on
boolean ledpin_3 = 1; // 0 or 1 for if the 3rd led should be on
boolean ledpin_4 = 1; // 0 or 1 for if the 4th led should be on
boolean ledpin_5 = 1; // 0 or 1 for if the 5th led should be on
boolean ledpin_6 = 1; // 0 or 1 for if the 6th led should be on
int pot_value = 0; // input for the potentiometer used to control frequency
int analog_pin = 0; // input pin for pot
int freq = 0; //this is the counter that is counting up the bins
int freqmax = 10; //this will be the amount the counter counts up before going to the next part of the array, by changing this we can alter the frequency
int sinarray [] = {0,0,87,0,0,87,3,0,85,0,0,88,7,0,83,0,0,90,10,0,81,0,0,91,14,0,79,0,0,93,17,0,77,0,0,94,21,0,74,0,0,95,24,0,72,0,0,96,28,0,69,0,0,97,31,0,67,0,0,98,34,0,64,0,0,98,37,0,62,0,0,99,41,0,59,0,0,99,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,100,59,0,41,0,0,99,62,0,37,0,0,99,64,0,34,0,0,98,67,0,31,0,0,98,69,0,28,0,0,97,72,0,24,0,0,96,74,0,21,0,0,95,77,0,17,0,0,94,79,0,14,0,0,93,81,0,10,0,0,91,83,0,7,0,0,90,85,0,3,0,0,88,87,0,0,0,0,87,88,0,0,3,0,85,90,0,0,7,0,83,91,0,0,10,0,81,93,0,0,14,0,79,94,0,0,17,0,77,95,0,0,21,0,74,96,0,0,24,0,72,97,0,0,28,0,69,98,0,0,31,0,67,98,0,0,34,0,64,99,0,0,37,0,62,99,0,0,41,0,59,100,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,99,0,0,59,0,41,99,0,0,62,0,37,98,0,0,64,0,34,98,0,0,67,0,31,97,0,0,69,0,28,96,0,0,72,0,24,95,0,0,74,0,21,94,0,0,77,0,17,93,0,0,79,0,14,91,0,0,81,0,10,90,0,0,83,0,7,88,0,0,85,0,3,87,0,0,87,0,0,85,0,0,88,3,0,83,0,0,90,7,0,81,0,0,91,10,0,79,0,0,93,14,0,77,0,0,94,17,0,74,0,0,95,21,0,72,0,0,96,24,0,69,0,0,97,28,0,67,0,0,98,31,0,64,0,0,98,34,0,62,0,0,99,37,0,59,0,0,99,41,0,56,0,0,100,44,0,53,0,0,100,47,0,50,0,0,100,50,0,47,0,0,100,53,0,44,0,0,100,56,0,41,0,0,99,59,0,37,0,0,99,62,0,34,0,0,98,64,0,31,0,0,98,67,0,28,0,0,97,69,0,24,0,0,96,72,0,21,0,0,95,74,0,17,0,0,94,77,0,14,0,0,93,79,0,10,0,0,91,81,0,7,0,0,90,83,0,3,0,0,88,85,0,0,0,0,87,87,0,0,3,0,85,88,0,0,7,0,83,90,0,0,10,0,81,91,0,0,14,0,79,93,0,0,17,0,77,94,0,0,21,0,74,95,0,0,24,0,72,96,0,0,28,0,69,97,0,0,31,0,67,98,0,0,34,0,64,98,0,0,37,0,62,99,0,0,41,0,59,99,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,100,0,0,59,0,41,99,0,0,62,0,37,99,0,0,64,0,34,98,0,0,67,0,31,98,0,0,69,0,28,97,0,0,72,0,24,96,0,0,74,0,21,95,0,0,77,0,17,94,0,0,79,0,14,93,0,0,81,0,10,91,0,0,83,0,7,90,0,0,85,0,3,88,0,0,87,0,0,87,0,0,88,3,0,85,0,0,90,7,0,83,0,0,91,10,0,81,0,0,93,14,0,79,0,0,94,17,0,77,0,0,95,21,0,74,0,0,96,24,0,72,0,0,97,28,0,69,0,0,98,31,0,67,0,0,98,34,0,64,0,0,99,37,0,62,0,0,99,41,0,59,0,0,100,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,99,59,0,41,0,0,99,62,0,37,0,0,98,64,0,34,0,0,98,67,0,31,0,0,97,69,0,28,0,0,96,72,0,24,0,0,95,74,0,21,0,0,94,77,0,17,0,0,93,79,0,14,0,0,91,81,0,10,0,0,90,83,0,7,0,0,88,85,0,3,0,0,87,87,0,0,0,0,85,88,0,0,3,0,83,90,0,0,7,0,81,91,0,0,10,0,79,93,0,0,14,0,77,94,0,0,17,0,74,95,0,0,21,0,72,96,0,0,24,0,69,97,0,0,28,0,67,98,0,0,31,0,64,98,0,0,34,0,62,99,0,0,37,0,59,99,0,0,41,0,56,100,0,0,44,0,53,100,0,0,47,0,50,100,0,0,50,0,47,100,0,0,53,0,44,100,0,0,56,0,41,99,0,0,59,0,37,99,0,0,62,0,34,98,0,0,64,0,31,98,0,0,67,0,28,97,0,0,69,0,24,96,0,0,72,0,21,95,0,0,74,0,17,94,0,0,77,0,14,93,0,0,79,0,10,91,0,0,81,0,7,90,0,0,83,0,3,88,0,0,85};
int max_volts = 95; // controls amplitude of the sin wave
int analog_volt = 1;
int value_pwm_1 = 0; // variable to keep the actual value_pwm_1
int array_tag_1 = 0; // where to get first value for phase 1 positive from array, first value in array is tagged at 0
int on_pulses_pin1 = 0; // counter for how many pulses pin 1 has been on
int value_pwm_2 = 0; // variable to keep the actual value_pwm_2
int array_tag_2 = 1; // where to get first value for phase 1 negative from array
int on_pulses_pin2 = 0;
int value_pwm_3 = 0; // variable to keep the actual value_pwm_2
int array_tag_3 = 4; // where to get first value for phase 2 positive from array
int on_pulses_pin3 = 0;
int value_pwm_4 = 0; // variable to keep the actual value_pwm_2
int array_tag_4 = 5; // where to get first value for phase 2 negative from array
int on_pulses_pin4 = 0;
int value_pwm_5 = 0; // variable to keep the actual value_pwm_2
int array_tag_5 = 2; // where to get first value for phase 3 positive from array
int on_pulses_pin5 = 0;
int value_pwm_6 = 0; // variable to keep the actual value_pwm_2
int array_tag_6 = 3; // where to get first value for phase 3 negative from array
int on_pulses_pin6 = 0;
void setup()
{
TIMSK0 = (1< // flag a (OCF0A) is written
TCCR0A = (0< TCCR0B = (0< OCR0A = 200; // this is the CTC value, this value gets changed to
// change the resolution of the counter
DDRC = 255; // this sets all of port C to outputs.
}
// This should be the routine called everytime the timer gets to the value of OCR0A
void callback()
{
if (freq >= freqmax)
{
freq = 0;
if (array_tag_1 < 1074) // 1074 is the last the last array tag for phase 1 postive, so below that we add 6 to each tag to get to the next spot for each phase in the array
{
array_tag_1 = array_tag_1 + 6;
array_tag_2 = array_tag_2 + 6;
array_tag_3 = array_tag_3 + 6;
array_tag_4 = array_tag_4 + 6;
array_tag_5 = array_tag_5 + 6;
array_tag_6 = array_tag_6 + 6;
}
else
{ // after 1074 we reset all the array tags to their original value
array_tag_1 = 0; // this resets the array counters back to zero
array_tag_2 = 1;
array_tag_3 = 4;
array_tag_4 = 5;
array_tag_5 = 2;
array_tag_6 = 3;
}
}
else
{
freq = freq + 1;
on_pulses_pin1 = (sinarray[array_tag_1] * freqmax / 100);
on_pulses_pin2 = (sinarray[array_tag_2] * freqmax / 100);
on_pulses_pin3 = (sinarray[array_tag_3] * freqmax / 100);
on_pulses_pin4 = (sinarray[array_tag_4] * freqmax / 100);
on_pulses_pin5 = (sinarray[array_tag_5] * freqmax / 100);
on_pulses_pin6 = (sinarray[array_tag_6] * freqmax / 100);
}
//PIN 1
if (on_pulses_pin1>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_1 = 1;
}
else
{
ledpin_1 = 0;
}
//PIN 2
if (on_pulses_pin2>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_2 = 1;
}
else
{
ledpin_2 = 0;
}
//PIN 3
if (on_pulses_pin3>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_3 = 1;
}
else
{
ledpin_3 = 0;
}
//PIN 4
if (on_pulses_pin4>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_4 = 1;
}
else
{
ledpin_4 = 0;
}
//PIN 5
if (on_pulses_pin5>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_5 = 1;
}
else
{
ledpin_5 = 0;
}
//PIN 6
if (on_pulses_pin6>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_6 = 1;
}
else
{
ledpin_6 = 0;
}
// Set all outputs
PORTC = (0<
}
void loop()
{
// pot_value = analogRead(analog_pin) / 100; // using a pot to control the frequency
// max_volts = analogRead(analog_volt) / 4; // changes the max voltage based on the second pot
pot_value = 100;
// port A looks like the analog inputs
// port B looks safe to play with
// port C looks safe to play with
// port D looks like it has the tx and rx pins
// Disable interrupts
// cli();
// Enable interrupts
// sei();
}
It works to speed up and slow down the phases, but I haven't been able to control the maximum voltage yet. I think I'm running into a problem of the interrupt service routine being too long.
Cheers.
// this will be an attempt to change how the pwm is done, and use interupts and direct port access with a higher speed
// port C > 7= pin 23
// port C > 6= pin 22
// port C > 5= pin 21
// port C > 4= pin 20
// port C > 3= pin 19
// port C > 2= pin 18
// port C > 1= pin 17
// port C > 0= pin 16
#include
#include
ISR(TIMER0_COMPA_vect) {
callback();
}
boolean ledpin_1 = 1; // 0 or 1 for if the 1st led should be on
boolean ledpin_2 = 1; // 0 or 1 for if the 2nd led should be on
boolean ledpin_3 = 1; // 0 or 1 for if the 3rd led should be on
boolean ledpin_4 = 1; // 0 or 1 for if the 4th led should be on
boolean ledpin_5 = 1; // 0 or 1 for if the 5th led should be on
boolean ledpin_6 = 1; // 0 or 1 for if the 6th led should be on
int pot_value = 0; // input for the potentiometer used to control frequency
int analog_pin = 0; // input pin for pot
int freq = 0; //this is the counter that is counting up the bins
int freqmax = 10; //this will be the amount the counter counts up before going to the next part of the array, by changing this we can alter the frequency
int sinarray [] = {0,0,87,0,0,87,3,0,85,0,0,88,7,0,83,0,0,90,10,0,81,0,0,91,14,0,79,0,0,93,17,0,77,0,0,94,21,0,74,0,0,95,24,0,72,0,0,96,28,0,69,0,0,97,31,0,67,0,0,98,34,0,64,0,0,98,37,0,62,0,0,99,41,0,59,0,0,99,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,100,59,0,41,0,0,99,62,0,37,0,0,99,64,0,34,0,0,98,67,0,31,0,0,98,69,0,28,0,0,97,72,0,24,0,0,96,74,0,21,0,0,95,77,0,17,0,0,94,79,0,14,0,0,93,81,0,10,0,0,91,83,0,7,0,0,90,85,0,3,0,0,88,87,0,0,0,0,87,88,0,0,3,0,85,90,0,0,7,0,83,91,0,0,10,0,81,93,0,0,14,0,79,94,0,0,17,0,77,95,0,0,21,0,74,96,0,0,24,0,72,97,0,0,28,0,69,98,0,0,31,0,67,98,0,0,34,0,64,99,0,0,37,0,62,99,0,0,41,0,59,100,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,99,0,0,59,0,41,99,0,0,62,0,37,98,0,0,64,0,34,98,0,0,67,0,31,97,0,0,69,0,28,96,0,0,72,0,24,95,0,0,74,0,21,94,0,0,77,0,17,93,0,0,79,0,14,91,0,0,81,0,10,90,0,0,83,0,7,88,0,0,85,0,3,87,0,0,87,0,0,85,0,0,88,3,0,83,0,0,90,7,0,81,0,0,91,10,0,79,0,0,93,14,0,77,0,0,94,17,0,74,0,0,95,21,0,72,0,0,96,24,0,69,0,0,97,28,0,67,0,0,98,31,0,64,0,0,98,34,0,62,0,0,99,37,0,59,0,0,99,41,0,56,0,0,100,44,0,53,0,0,100,47,0,50,0,0,100,50,0,47,0,0,100,53,0,44,0,0,100,56,0,41,0,0,99,59,0,37,0,0,99,62,0,34,0,0,98,64,0,31,0,0,98,67,0,28,0,0,97,69,0,24,0,0,96,72,0,21,0,0,95,74,0,17,0,0,94,77,0,14,0,0,93,79,0,10,0,0,91,81,0,7,0,0,90,83,0,3,0,0,88,85,0,0,0,0,87,87,0,0,3,0,85,88,0,0,7,0,83,90,0,0,10,0,81,91,0,0,14,0,79,93,0,0,17,0,77,94,0,0,21,0,74,95,0,0,24,0,72,96,0,0,28,0,69,97,0,0,31,0,67,98,0,0,34,0,64,98,0,0,37,0,62,99,0,0,41,0,59,99,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,100,0,0,59,0,41,99,0,0,62,0,37,99,0,0,64,0,34,98,0,0,67,0,31,98,0,0,69,0,28,97,0,0,72,0,24,96,0,0,74,0,21,95,0,0,77,0,17,94,0,0,79,0,14,93,0,0,81,0,10,91,0,0,83,0,7,90,0,0,85,0,3,88,0,0,87,0,0,87,0,0,88,3,0,85,0,0,90,7,0,83,0,0,91,10,0,81,0,0,93,14,0,79,0,0,94,17,0,77,0,0,95,21,0,74,0,0,96,24,0,72,0,0,97,28,0,69,0,0,98,31,0,67,0,0,98,34,0,64,0,0,99,37,0,62,0,0,99,41,0,59,0,0,100,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,99,59,0,41,0,0,99,62,0,37,0,0,98,64,0,34,0,0,98,67,0,31,0,0,97,69,0,28,0,0,96,72,0,24,0,0,95,74,0,21,0,0,94,77,0,17,0,0,93,79,0,14,0,0,91,81,0,10,0,0,90,83,0,7,0,0,88,85,0,3,0,0,87,87,0,0,0,0,85,88,0,0,3,0,83,90,0,0,7,0,81,91,0,0,10,0,79,93,0,0,14,0,77,94,0,0,17,0,74,95,0,0,21,0,72,96,0,0,24,0,69,97,0,0,28,0,67,98,0,0,31,0,64,98,0,0,34,0,62,99,0,0,37,0,59,99,0,0,41,0,56,100,0,0,44,0,53,100,0,0,47,0,50,100,0,0,50,0,47,100,0,0,53,0,44,100,0,0,56,0,41,99,0,0,59,0,37,99,0,0,62,0,34,98,0,0,64,0,31,98,0,0,67,0,28,97,0,0,69,0,24,96,0,0,72,0,21,95,0,0,74,0,17,94,0,0,77,0,14,93,0,0,79,0,10,91,0,0,81,0,7,90,0,0,83,0,3,88,0,0,85};
int max_volts = 95; // controls amplitude of the sin wave
int analog_volt = 1;
int value_pwm_1 = 0; // variable to keep the actual value_pwm_1
int array_tag_1 = 0; // where to get first value for phase 1 positive from array, first value in array is tagged at 0
int on_pulses_pin1 = 0; // counter for how many pulses pin 1 has been on
int value_pwm_2 = 0; // variable to keep the actual value_pwm_2
int array_tag_2 = 1; // where to get first value for phase 1 negative from array
int on_pulses_pin2 = 0;
int value_pwm_3 = 0; // variable to keep the actual value_pwm_2
int array_tag_3 = 4; // where to get first value for phase 2 positive from array
int on_pulses_pin3 = 0;
int value_pwm_4 = 0; // variable to keep the actual value_pwm_2
int array_tag_4 = 5; // where to get first value for phase 2 negative from array
int on_pulses_pin4 = 0;
int value_pwm_5 = 0; // variable to keep the actual value_pwm_2
int array_tag_5 = 2; // where to get first value for phase 3 positive from array
int on_pulses_pin5 = 0;
int value_pwm_6 = 0; // variable to keep the actual value_pwm_2
int array_tag_6 = 3; // where to get first value for phase 3 negative from array
int on_pulses_pin6 = 0;
void setup()
{
TIMSK0 = (1<
TCCR0A = (0<
// change the resolution of the counter
DDRC = 255; // this sets all of port C to outputs.
}
// This should be the routine called everytime the timer gets to the value of OCR0A
void callback()
{
if (freq >= freqmax)
{
freq = 0;
if (array_tag_1 < 1074) // 1074 is the last the last array tag for phase 1 postive, so below that we add 6 to each tag to get to the next spot for each phase in the array
{
array_tag_1 = array_tag_1 + 6;
array_tag_2 = array_tag_2 + 6;
array_tag_3 = array_tag_3 + 6;
array_tag_4 = array_tag_4 + 6;
array_tag_5 = array_tag_5 + 6;
array_tag_6 = array_tag_6 + 6;
}
else
{ // after 1074 we reset all the array tags to their original value
array_tag_1 = 0; // this resets the array counters back to zero
array_tag_2 = 1;
array_tag_3 = 4;
array_tag_4 = 5;
array_tag_5 = 2;
array_tag_6 = 3;
}
}
else
{
freq = freq + 1;
on_pulses_pin1 = (sinarray[array_tag_1] * freqmax / 100);
on_pulses_pin2 = (sinarray[array_tag_2] * freqmax / 100);
on_pulses_pin3 = (sinarray[array_tag_3] * freqmax / 100);
on_pulses_pin4 = (sinarray[array_tag_4] * freqmax / 100);
on_pulses_pin5 = (sinarray[array_tag_5] * freqmax / 100);
on_pulses_pin6 = (sinarray[array_tag_6] * freqmax / 100);
}
//PIN 1
if (on_pulses_pin1>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_1 = 1;
}
else
{
ledpin_1 = 0;
}
//PIN 2
if (on_pulses_pin2>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_2 = 1;
}
else
{
ledpin_2 = 0;
}
//PIN 3
if (on_pulses_pin3>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_3 = 1;
}
else
{
ledpin_3 = 0;
}
//PIN 4
if (on_pulses_pin4>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_4 = 1;
}
else
{
ledpin_4 = 0;
}
//PIN 5
if (on_pulses_pin5>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_5 = 1;
}
else
{
ledpin_5 = 0;
}
//PIN 6
if (on_pulses_pin6>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
ledpin_6 = 1;
}
else
{
ledpin_6 = 0;
}
// Set all outputs
PORTC = (0<
}
void loop()
{
// pot_value = analogRead(analog_pin) / 100; // using a pot to control the frequency
// max_volts = analogRead(analog_volt) / 4; // changes the max voltage based on the second pot
pot_value = 100;
// port A looks like the analog inputs
// port B looks safe to play with
// port C looks safe to play with
// port D looks like it has the tx and rx pins
// Disable interrupts
// cli();
// Enable interrupts
// sei();
}
Monday, January 12, 2009
Arduino Libraries
It seems that the timerone.h library from the arduino site does not work with the sanguino. I'm heading to New York for the week and will take the datasheets with me to see if I can figure out why. It may be something simple like the Library references the wrong pins, or the wrong control registers. Here is the current non-functioning attempt at code using an interupt to time the Pulse width instead of a delay function.
//this will be an attempt to change how the pwm is done, and use interupts with a higher speed
#include "TimerOne.h"
int freq = 0; //this is the counter that is counting up the bins
int freqmax = 1000; //this will be the amount the counter counts up before going to the next part of the array, by changing this we can alter the frequency
int sinarray [] = {0,0,87,0,0,87,3,0,85,0,0,88,7,0,83,0,0,90,10,0,81,0,0,91,14,0,79,0,0,93,17,0,77,0,0,94,21,0,74,0,0,95,24,0,72,0,0,96,28,0,69,0,0,97,31,0,67,0,0,98,34,0,64,0,0,98,37,0,62,0,0,99,41,0,59,0,0,99,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,100,59,0,41,0,0,99,62,0,37,0,0,99,64,0,34,0,0,98,67,0,31,0,0,98,69,0,28,0,0,97,72,0,24,0,0,96,74,0,21,0,0,95,77,0,17,0,0,94,79,0,14,0,0,93,81,0,10,0,0,91,83,0,7,0,0,90,85,0,3,0,0,88,87,0,0,0,0,87,88,0,0,3,0,85,90,0,0,7,0,83,91,0,0,10,0,81,93,0,0,14,0,79,94,0,0,17,0,77,95,0,0,21,0,74,96,0,0,24,0,72,97,0,0,28,0,69,98,0,0,31,0,67,98,0,0,34,0,64,99,0,0,37,0,62,99,0,0,41,0,59,100,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,99,0,0,59,0,41,99,0,0,62,0,37,98,0,0,64,0,34,98,0,0,67,0,31,97,0,0,69,0,28,96,0,0,72,0,24,95,0,0,74,0,21,94,0,0,77,0,17,93,0,0,79,0,14,91,0,0,81,0,10,90,0,0,83,0,7,88,0,0,85,0,3,87,0,0,87,0,0,85,0,0,88,3,0,83,0,0,90,7,0,81,0,0,91,10,0,79,0,0,93,14,0,77,0,0,94,17,0,74,0,0,95,21,0,72,0,0,96,24,0,69,0,0,97,28,0,67,0,0,98,31,0,64,0,0,98,34,0,62,0,0,99,37,0,59,0,0,99,41,0,56,0,0,100,44,0,53,0,0,100,47,0,50,0,0,100,50,0,47,0,0,100,53,0,44,0,0,100,56,0,41,0,0,99,59,0,37,0,0,99,62,0,34,0,0,98,64,0,31,0,0,98,67,0,28,0,0,97,69,0,24,0,0,96,72,0,21,0,0,95,74,0,17,0,0,94,77,0,14,0,0,93,79,0,10,0,0,91,81,0,7,0,0,90,83,0,3,0,0,88,85,0,0,0,0,87,87,0,0,3,0,85,88,0,0,7,0,83,90,0,0,10,0,81,91,0,0,14,0,79,93,0,0,17,0,77,94,0,0,21,0,74,95,0,0,24,0,72,96,0,0,28,0,69,97,0,0,31,0,67,98,0,0,34,0,64,98,0,0,37,0,62,99,0,0,41,0,59,99,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,100,0,0,59,0,41,99,0,0,62,0,37,99,0,0,64,0,34,98,0,0,67,0,31,98,0,0,69,0,28,97,0,0,72,0,24,96,0,0,74,0,21,95,0,0,77,0,17,94,0,0,79,0,14,93,0,0,81,0,10,91,0,0,83,0,7,90,0,0,85,0,3,88,0,0,87,0,0,87,0,0,88,3,0,85,0,0,90,7,0,83,0,0,91,10,0,81,0,0,93,14,0,79,0,0,94,17,0,77,0,0,95,21,0,74,0,0,96,24,0,72,0,0,97,28,0,69,0,0,98,31,0,67,0,0,98,34,0,64,0,0,99,37,0,62,0,0,99,41,0,59,0,0,100,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,99,59,0,41,0,0,99,62,0,37,0,0,98,64,0,34,0,0,98,67,0,31,0,0,97,69,0,28,0,0,96,72,0,24,0,0,95,74,0,21,0,0,94,77,0,17,0,0,93,79,0,14,0,0,91,81,0,10,0,0,90,83,0,7,0,0,88,85,0,3,0,0,87,87,0,0,0,0,85,88,0,0,3,0,83,90,0,0,7,0,81,91,0,0,10,0,79,93,0,0,14,0,77,94,0,0,17,0,74,95,0,0,21,0,72,96,0,0,24,0,69,97,0,0,28,0,67,98,0,0,31,0,64,98,0,0,34,0,62,99,0,0,37,0,59,99,0,0,41,0,56,100,0,0,44,0,53,100,0,0,47,0,50,100,0,0,50,0,47,100,0,0,53,0,44,100,0,0,56,0,41,99,0,0,59,0,37,99,0,0,62,0,34,98,0,0,64,0,31,98,0,0,67,0,28,97,0,0,69,0,24,96,0,0,72,0,21,95,0,0,74,0,17,94,0,0,77,0,14,93,0,0,79,0,10,91,0,0,81,0,7,90,0,0,83,0,3,88,0,0,85};
int pot_value = 0; // input for the potentiometer used to control frequency
int analog_pin = 0; // input pin for pot
int max_volts = 0; // controls amplitude of the sin wave
int analog_volt = 1;
int value_pwm_1 = 0; // variable to keep the actual value_pwm_1
int ledpin_1 = 3; // light connected to digital pin 3
int array_tag_1 = 0; // where to get first value for phase 1 positive from array, first value in array is tagged at 0
int on_pulses_pin1 = 0;
int value_pwm_2 = 0; // variable to keep the actual value_pwm_2
int ledpin_2 = 4; // light connected to digital pin 4
int array_tag_2 = 1; // where to get first value for phase 1 negative from array
int on_pulses_pin2 = 0;
int value_pwm_3 = 0; // variable to keep the actual value_pwm_2
int ledpin_3 = 12; // light connected to digital pin 12
int array_tag_3 = 4; // where to get first value for phase 2 positive from array
int on_pulses_pin3 = 0;
int value_pwm_4 = 0; // variable to keep the actual value_pwm_2
int ledpin_4 = 13; // light connected to digital pin 13
int array_tag_4 = 5; // where to get first value for phase 2 negative from array
int on_pulses_pin4 = 0;
int value_pwm_5 = 0; // variable to keep the actual value_pwm_2
int ledpin_5 = 14; // light connected to digital pin 14
int array_tag_5 = 2; // where to get first value for phase 3 positive from array
int on_pulses_pin5 = 0;
int value_pwm_6 = 0; // variable to keep the actual value_pwm_2
int ledpin_6 = 15; // light connected to digital pin 15
int array_tag_6 = 3; // where to get first value for phase 3 negative from array
int on_pulses_pin6 = 0;
void setup()
{
pinMode(7, OUTPUT); // using an LED on pin 7 to indicate the completion of one complete cycle on phase 1
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(14, OUTPUT);
pinMode(15, OUTPUT);
Timer1.initialize(100); // initialize timer1, and set a 1/1000 second period, can this be changed dynamically in the program?
Timer1.attachInterrupt(callback); // attaches callback() as a timer overflow interrupt
}
void callback()
{
if (freq >= freqmax)
{
freq = 0;
if (array_tag_1 < 1074)
{ // 1074 is the last the last array tag for phase 1 postive, so below that we add 6 to each tag to get to the next spot for each phase in the array
array_tag_1 = array_tag_1 + 6;
array_tag_2 = array_tag_2 + 6;
array_tag_3 = array_tag_3 + 6;
array_tag_4 = array_tag_4 + 6;
array_tag_5 = array_tag_5 + 6;
array_tag_6 = array_tag_6 + 6;
}
else
{ // after 1074 we reset all the array tags to their original value
array_tag_1 = 0; // this resets the array counters back to zero
array_tag_2 = 1;
array_tag_3 = 4;
array_tag_4 = 5;
array_tag_5 = 2;
array_tag_6 = 3;
}
}
else
{
freq = freq + 1;
on_pulses_pin1 = (sinarray[array_tag_1] * freqmax / 100);
on_pulses_pin2 = (sinarray[array_tag_2] * freqmax / 100);
on_pulses_pin3 = (sinarray[array_tag_3] * freqmax / 100);
on_pulses_pin4 = (sinarray[array_tag_4] * freqmax / 100);
on_pulses_pin5 = (sinarray[array_tag_5] * freqmax / 100);
on_pulses_pin6 = (sinarray[array_tag_6] * freqmax / 100);
if (on_pulses_pin1>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
digitalWrite(ledpin_1, HIGH);
}
else
{
digitalWrite(ledpin_1, LOW);
}
if (on_pulses_pin2>freq) //
{
digitalWrite(ledpin_2, HIGH);
}
else
{
digitalWrite(ledpin_2, LOW);
}
if (on_pulses_pin3>freq) //
{
digitalWrite(ledpin_3, HIGH);
}
else
{
digitalWrite(ledpin_3, LOW);
}
if (on_pulses_pin4>freq) //
{
digitalWrite(ledpin_4, HIGH);
}
else
{
digitalWrite(ledpin_4, LOW);
}
if (on_pulses_pin5>freq) //
{
digitalWrite(ledpin_5, HIGH);
}
else
{
digitalWrite(ledpin_5, LOW);
}
if (on_pulses_pin6>freq) //
{
digitalWrite(ledpin_6, HIGH);
}
else
{
digitalWrite(ledpin_6, LOW);
}
}
}
void loop()
{
pot_value = analogRead(analog_pin) / 100; // using a pot to control the frequency
max_volts = analogRead(analog_volt) / 4; // changes the max voltage based on the second pot
}
//this will be an attempt to change how the pwm is done, and use interupts with a higher speed
#include "TimerOne.h"
int freq = 0; //this is the counter that is counting up the bins
int freqmax = 1000; //this will be the amount the counter counts up before going to the next part of the array, by changing this we can alter the frequency
int sinarray [] = {0,0,87,0,0,87,3,0,85,0,0,88,7,0,83,0,0,90,10,0,81,0,0,91,14,0,79,0,0,93,17,0,77,0,0,94,21,0,74,0,0,95,24,0,72,0,0,96,28,0,69,0,0,97,31,0,67,0,0,98,34,0,64,0,0,98,37,0,62,0,0,99,41,0,59,0,0,99,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,100,59,0,41,0,0,99,62,0,37,0,0,99,64,0,34,0,0,98,67,0,31,0,0,98,69,0,28,0,0,97,72,0,24,0,0,96,74,0,21,0,0,95,77,0,17,0,0,94,79,0,14,0,0,93,81,0,10,0,0,91,83,0,7,0,0,90,85,0,3,0,0,88,87,0,0,0,0,87,88,0,0,3,0,85,90,0,0,7,0,83,91,0,0,10,0,81,93,0,0,14,0,79,94,0,0,17,0,77,95,0,0,21,0,74,96,0,0,24,0,72,97,0,0,28,0,69,98,0,0,31,0,67,98,0,0,34,0,64,99,0,0,37,0,62,99,0,0,41,0,59,100,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,99,0,0,59,0,41,99,0,0,62,0,37,98,0,0,64,0,34,98,0,0,67,0,31,97,0,0,69,0,28,96,0,0,72,0,24,95,0,0,74,0,21,94,0,0,77,0,17,93,0,0,79,0,14,91,0,0,81,0,10,90,0,0,83,0,7,88,0,0,85,0,3,87,0,0,87,0,0,85,0,0,88,3,0,83,0,0,90,7,0,81,0,0,91,10,0,79,0,0,93,14,0,77,0,0,94,17,0,74,0,0,95,21,0,72,0,0,96,24,0,69,0,0,97,28,0,67,0,0,98,31,0,64,0,0,98,34,0,62,0,0,99,37,0,59,0,0,99,41,0,56,0,0,100,44,0,53,0,0,100,47,0,50,0,0,100,50,0,47,0,0,100,53,0,44,0,0,100,56,0,41,0,0,99,59,0,37,0,0,99,62,0,34,0,0,98,64,0,31,0,0,98,67,0,28,0,0,97,69,0,24,0,0,96,72,0,21,0,0,95,74,0,17,0,0,94,77,0,14,0,0,93,79,0,10,0,0,91,81,0,7,0,0,90,83,0,3,0,0,88,85,0,0,0,0,87,87,0,0,3,0,85,88,0,0,7,0,83,90,0,0,10,0,81,91,0,0,14,0,79,93,0,0,17,0,77,94,0,0,21,0,74,95,0,0,24,0,72,96,0,0,28,0,69,97,0,0,31,0,67,98,0,0,34,0,64,98,0,0,37,0,62,99,0,0,41,0,59,99,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,100,0,0,59,0,41,99,0,0,62,0,37,99,0,0,64,0,34,98,0,0,67,0,31,98,0,0,69,0,28,97,0,0,72,0,24,96,0,0,74,0,21,95,0,0,77,0,17,94,0,0,79,0,14,93,0,0,81,0,10,91,0,0,83,0,7,90,0,0,85,0,3,88,0,0,87,0,0,87,0,0,88,3,0,85,0,0,90,7,0,83,0,0,91,10,0,81,0,0,93,14,0,79,0,0,94,17,0,77,0,0,95,21,0,74,0,0,96,24,0,72,0,0,97,28,0,69,0,0,98,31,0,67,0,0,98,34,0,64,0,0,99,37,0,62,0,0,99,41,0,59,0,0,100,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,99,59,0,41,0,0,99,62,0,37,0,0,98,64,0,34,0,0,98,67,0,31,0,0,97,69,0,28,0,0,96,72,0,24,0,0,95,74,0,21,0,0,94,77,0,17,0,0,93,79,0,14,0,0,91,81,0,10,0,0,90,83,0,7,0,0,88,85,0,3,0,0,87,87,0,0,0,0,85,88,0,0,3,0,83,90,0,0,7,0,81,91,0,0,10,0,79,93,0,0,14,0,77,94,0,0,17,0,74,95,0,0,21,0,72,96,0,0,24,0,69,97,0,0,28,0,67,98,0,0,31,0,64,98,0,0,34,0,62,99,0,0,37,0,59,99,0,0,41,0,56,100,0,0,44,0,53,100,0,0,47,0,50,100,0,0,50,0,47,100,0,0,53,0,44,100,0,0,56,0,41,99,0,0,59,0,37,99,0,0,62,0,34,98,0,0,64,0,31,98,0,0,67,0,28,97,0,0,69,0,24,96,0,0,72,0,21,95,0,0,74,0,17,94,0,0,77,0,14,93,0,0,79,0,10,91,0,0,81,0,7,90,0,0,83,0,3,88,0,0,85};
int pot_value = 0; // input for the potentiometer used to control frequency
int analog_pin = 0; // input pin for pot
int max_volts = 0; // controls amplitude of the sin wave
int analog_volt = 1;
int value_pwm_1 = 0; // variable to keep the actual value_pwm_1
int ledpin_1 = 3; // light connected to digital pin 3
int array_tag_1 = 0; // where to get first value for phase 1 positive from array, first value in array is tagged at 0
int on_pulses_pin1 = 0;
int value_pwm_2 = 0; // variable to keep the actual value_pwm_2
int ledpin_2 = 4; // light connected to digital pin 4
int array_tag_2 = 1; // where to get first value for phase 1 negative from array
int on_pulses_pin2 = 0;
int value_pwm_3 = 0; // variable to keep the actual value_pwm_2
int ledpin_3 = 12; // light connected to digital pin 12
int array_tag_3 = 4; // where to get first value for phase 2 positive from array
int on_pulses_pin3 = 0;
int value_pwm_4 = 0; // variable to keep the actual value_pwm_2
int ledpin_4 = 13; // light connected to digital pin 13
int array_tag_4 = 5; // where to get first value for phase 2 negative from array
int on_pulses_pin4 = 0;
int value_pwm_5 = 0; // variable to keep the actual value_pwm_2
int ledpin_5 = 14; // light connected to digital pin 14
int array_tag_5 = 2; // where to get first value for phase 3 positive from array
int on_pulses_pin5 = 0;
int value_pwm_6 = 0; // variable to keep the actual value_pwm_2
int ledpin_6 = 15; // light connected to digital pin 15
int array_tag_6 = 3; // where to get first value for phase 3 negative from array
int on_pulses_pin6 = 0;
void setup()
{
pinMode(7, OUTPUT); // using an LED on pin 7 to indicate the completion of one complete cycle on phase 1
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(14, OUTPUT);
pinMode(15, OUTPUT);
Timer1.initialize(100); // initialize timer1, and set a 1/1000 second period, can this be changed dynamically in the program?
Timer1.attachInterrupt(callback); // attaches callback() as a timer overflow interrupt
}
void callback()
{
if (freq >= freqmax)
{
freq = 0;
if (array_tag_1 < 1074)
{ // 1074 is the last the last array tag for phase 1 postive, so below that we add 6 to each tag to get to the next spot for each phase in the array
array_tag_1 = array_tag_1 + 6;
array_tag_2 = array_tag_2 + 6;
array_tag_3 = array_tag_3 + 6;
array_tag_4 = array_tag_4 + 6;
array_tag_5 = array_tag_5 + 6;
array_tag_6 = array_tag_6 + 6;
}
else
{ // after 1074 we reset all the array tags to their original value
array_tag_1 = 0; // this resets the array counters back to zero
array_tag_2 = 1;
array_tag_3 = 4;
array_tag_4 = 5;
array_tag_5 = 2;
array_tag_6 = 3;
}
}
else
{
freq = freq + 1;
on_pulses_pin1 = (sinarray[array_tag_1] * freqmax / 100);
on_pulses_pin2 = (sinarray[array_tag_2] * freqmax / 100);
on_pulses_pin3 = (sinarray[array_tag_3] * freqmax / 100);
on_pulses_pin4 = (sinarray[array_tag_4] * freqmax / 100);
on_pulses_pin5 = (sinarray[array_tag_5] * freqmax / 100);
on_pulses_pin6 = (sinarray[array_tag_6] * freqmax / 100);
if (on_pulses_pin1>freq) //these if's check to see if each pins counter has reached its max and then turns the pins on or off as needed
{
digitalWrite(ledpin_1, HIGH);
}
else
{
digitalWrite(ledpin_1, LOW);
}
if (on_pulses_pin2>freq) //
{
digitalWrite(ledpin_2, HIGH);
}
else
{
digitalWrite(ledpin_2, LOW);
}
if (on_pulses_pin3>freq) //
{
digitalWrite(ledpin_3, HIGH);
}
else
{
digitalWrite(ledpin_3, LOW);
}
if (on_pulses_pin4>freq) //
{
digitalWrite(ledpin_4, HIGH);
}
else
{
digitalWrite(ledpin_4, LOW);
}
if (on_pulses_pin5>freq) //
{
digitalWrite(ledpin_5, HIGH);
}
else
{
digitalWrite(ledpin_5, LOW);
}
if (on_pulses_pin6>freq) //
{
digitalWrite(ledpin_6, HIGH);
}
else
{
digitalWrite(ledpin_6, LOW);
}
}
}
void loop()
{
pot_value = analogRead(analog_pin) / 100; // using a pot to control the frequency
max_volts = analogRead(analog_volt) / 4; // changes the max voltage based on the second pot
}
Sunday, January 11, 2009
OK, now tell us what the hell they are.
Dear Dr. Dawg,
Sorry for posting something a little obscure. IGBT's or Insulated Gate Bipolar Transistors, are fast acting high power semiconductor switches. The units I have are capable of switching 200 amps at 1200 Volts at a significantly high switching rate. This is what makes it possible to use pulse width modulation to turn the switches off and on really fast to generate a variable alternating current output from a dc source, like a big battery pack.
And if anyone knows how to use the timers directly on a Sanguino, please send me a note.
Sorry for posting something a little obscure. IGBT's or Insulated Gate Bipolar Transistors, are fast acting high power semiconductor switches. The units I have are capable of switching 200 amps at 1200 Volts at a significantly high switching rate. This is what makes it possible to use pulse width modulation to turn the switches off and on really fast to generate a variable alternating current output from a dc source, like a big battery pack.
And if anyone knows how to use the timers directly on a Sanguino, please send me a note.
Saturday, January 10, 2009
IGBT's have arrived!
Three fully functional 200A (450 peak!) 1200 V IGBT blocks arrived yesterday. I paid about 90 dollars Canadian including shipping and handling. These are generally about 2-300 dollars a piece new, so I think I did okay. They are actually smaller than I thought they'd be. I guess newer semiconductors produce less heat and so they can make the package smaller.
Wednesday, January 7, 2009
New book arriving
I looked up some relevant courses at UBC in Electrical Engineering in order to find relevant textbooks. I found a course that was titled "Electro-mechanical Energy Conversion and Transmission" which sounded pretty good. However the textbook "Electric Machinery Fundamentals" from Stephen Chapman is a $200 plus textbook. I found it used for about $30 on Amazon. Woo! Still waiting for the encoder and the IGBTs from ebay.
I need to learn how to seperate the magetizing current from the torque producing current so I can figure out an algorithm for feed back and control of the frequency and voltage output. I may just use a Voltage/frequency table to start, but I'd like to learn how to calculate the real output required for Vector Control.
On a side note, I had a comment from MSimon, who I think is one of the avid contibuters to the Talk-Polywell fusion forum which I read every morning. If you're at all interested in super-conducting magnets, plasma physics, massive pulsed capacitor banks, or other energy geek type stuff check it out.
I need to learn how to seperate the magetizing current from the torque producing current so I can figure out an algorithm for feed back and control of the frequency and voltage output. I may just use a Voltage/frequency table to start, but I'd like to learn how to calculate the real output required for Vector Control.
On a side note, I had a comment from MSimon, who I think is one of the avid contibuters to the Talk-Polywell fusion forum which I read every morning. If you're at all interested in super-conducting magnets, plasma physics, massive pulsed capacitor banks, or other energy geek type stuff check it out.
Tuesday, January 6, 2009
Political Interjection
How does this guy get appointed to the Senate?
http://www.theglobeandmail.com/servlet/story/RTGAM.20090106.wsenate06/BNStory/politics/home
Call me old fashioned, call me judgmental, but pony tails and more than one ring per hand is "not senate material."
http://www.theglobeandmail.com/servlet/story/RTGAM.20090106.wsenate06/BNStory/politics/home
Call me old fashioned, call me judgmental, but pony tails and more than one ring per hand is "not senate material."
3 phase sin wave
I've managed to generate a 3 phase sin wave on the sanguino. Its just pulsing LEDs at this point, but I am able to modulate the frequency and the amplitude. Still have lots of work to do as this current code uses the analogWrite command which does PWM at about 490 Hz. I'm going to need this to work a lot faster. Also I've used a delay command to change the frequency. I'd like to come up with a way to not use any delays in the program. Here it is if anyone is interested:
// 3 phase sin wave output
// by Swamijake
int sinarray [] = {0,0,87,0,0,87,3,0,85,0,0,88,7,0,83,0,0,90,10,0,81,0,0,91,14,0,79,0,0,93,17,0,77,0,0,94,21,0,74,0,0,95,24,0,72,0,0,96,28,0,69,0,0,97,31,0,67,0,0,98,34,0,64,0,0,98,37,0,62,0,0,99,41,0,59,0,0,99,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,100,59,0,41,0,0,99,62,0,37,0,0,99,64,0,34,0,0,98,67,0,31,0,0,98,69,0,28,0,0,97,72,0,24,0,0,96,74,0,21,0,0,95,77,0,17,0,0,94,79,0,14,0,0,93,81,0,10,0,0,91,83,0,7,0,0,90,85,0,3,0,0,88,87,0,0,0,0,87,88,0,0,3,0,85,90,0,0,7,0,83,91,0,0,10,0,81,93,0,0,14,0,79,94,0,0,17,0,77,95,0,0,21,0,74,96,0,0,24,0,72,97,0,0,28,0,69,98,0,0,31,0,67,98,0,0,34,0,64,99,0,0,37,0,62,99,0,0,41,0,59,100,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,99,0,0,59,0,41,99,0,0,62,0,37,98,0,0,64,0,34,98,0,0,67,0,31,97,0,0,69,0,28,96,0,0,72,0,24,95,0,0,74,0,21,94,0,0,77,0,17,93,0,0,79,0,14,91,0,0,81,0,10,90,0,0,83,0,7,88,0,0,85,0,3,87,0,0,87,0,0,85,0,0,88,3,0,83,0,0,90,7,0,81,0,0,91,10,0,79,0,0,93,14,0,77,0,0,94,17,0,74,0,0,95,21,0,72,0,0,96,24,0,69,0,0,97,28,0,67,0,0,98,31,0,64,0,0,98,34,0,62,0,0,99,37,0,59,0,0,99,41,0,56,0,0,100,44,0,53,0,0,100,47,0,50,0,0,100,50,0,47,0,0,100,53,0,44,0,0,100,56,0,41,0,0,99,59,0,37,0,0,99,62,0,34,0,0,98,64,0,31,0,0,98,67,0,28,0,0,97,69,0,24,0,0,96,72,0,21,0,0,95,74,0,17,0,0,94,77,0,14,0,0,93,79,0,10,0,0,91,81,0,7,0,0,90,83,0,3,0,0,88,85,0,0,0,0,87,87,0,0,3,0,85,88,0,0,7,0,83,90,0,0,10,0,81,91,0,0,14,0,79,93,0,0,17,0,77,94,0,0,21,0,74,95,0,0,24,0,72,96,0,0,28,0,69,97,0,0,31,0,67,98,0,0,34,0,64,98,0,0,37,0,62,99,0,0,41,0,59,99,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,100,0,0,59,0,41,99,0,0,62,0,37,99,0,0,64,0,34,98,0,0,67,0,31,98,0,0,69,0,28,97,0,0,72,0,24,96,0,0,74,0,21,95,0,0,77,0,17,94,0,0,79,0,14,93,0,0,81,0,10,91,0,0,83,0,7,90,0,0,85,0,3,88,0,0,87,0,0,87,0,0,88,3,0,85,0,0,90,7,0,83,0,0,91,10,0,81,0,0,93,14,0,79,0,0,94,17,0,77,0,0,95,21,0,74,0,0,96,24,0,72,0,0,97,28,0,69,0,0,98,31,0,67,0,0,98,34,0,64,0,0,99,37,0,62,0,0,99,41,0,59,0,0,100,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,99,59,0,41,0,0,99,62,0,37,0,0,98,64,0,34,0,0,98,67,0,31,0,0,97,69,0,28,0,0,96,72,0,24,0,0,95,74,0,21,0,0,94,77,0,17,0,0,93,79,0,14,0,0,91,81,0,10,0,0,90,83,0,7,0,0,88,85,0,3,0,0,87,87,0,0,0,0,85,88,0,0,3,0,83,90,0,0,7,0,81,91,0,0,10,0,79,93,0,0,14,0,77,94,0,0,17,0,74,95,0,0,21,0,72,96,0,0,24,0,69,97,0,0,28,0,67,98,0,0,31,0,64,98,0,0,34,0,62,99,0,0,37,0,59,99,0,0,41,0,56,100,0,0,44,0,53,100,0,0,47,0,50,100,0,0,50,0,47,100,0,0,53,0,44,100,0,0,56,0,41,99,0,0,59,0,37,99,0,0,62,0,34,98,0,0,64,0,31,98,0,0,67,0,28,97,0,0,69,0,24,96,0,0,72,0,21,95,0,0,74,0,17,94,0,0,77,0,14,93,0,0,79,0,10,91,0,0,81,0,7,90,0,0,83,0,3,88,0,0,85};
// generated the array in excel, it is 6 outputs (one positive and one negative for each phase) times 180 bins for 2 degree resolution
int pot_value = 0; // input for the potentiometer used to control frequency
int analog_pin = 0; // input pin for pot
int max_volts = 0; // controls amplitude of the sin wave
int analog_volt = 1;
int value_pwm_1 = 0; // variable to keep the actual value_pwm_1
int ledpin_1 = 3; // light connected to digital pin 3
int array_tag_1 = 0; // where to get first value for phase 1 positive from array, first value in array is tagged at 0
int value_pwm_2 = 0; // variable to keep the actual value_pwm_2
int ledpin_2 = 4; // light connected to digital pin 4
int array_tag_2 = 1; // where to get first value for phase 1 negative from array
int value_pwm_3 = 0; // variable to keep the actual value_pwm_2
int ledpin_3 = 12; // light connected to digital pin 12
int array_tag_3 = 2; // where to get first value for phase 2 positive from array
int value_pwm_4 = 0; // variable to keep the actual value_pwm_2
int ledpin_4 = 13; // light connected to digital pin 13
int array_tag_4 = 3; // where to get first value for phase 2 negative from array
int value_pwm_5 = 0; // variable to keep the actual value_pwm_2
int ledpin_5 = 14; // light connected to digital pin 14
int array_tag_5 = 4; // where to get first value for phase 3 positive from array
int value_pwm_6 = 0; // variable to keep the actual value_pwm_2
int ledpin_6 = 15; // light connected to digital pin 15
int array_tag_6 = 5; // where to get first value for phase 3 negative from array
void setup()
{
pinMode(7, OUTPUT); // using an LED on pin 7 to indicate the completion of one complete cycle on phase 1
}
void loop()
{
pot_value = analogRead(analog_pin) / 100; // using a pot to control the frequency
max_volts = analogRead(analog_volt) / 4; // changes the max voltage based on the second pot
analogWrite(ledpin_1, (sinarray[array_tag_1] * max_volts / 100)); // sets the value_pwm_1 picked from the array
analogWrite(ledpin_2, (sinarray[array_tag_2] * max_volts / 100)); // sets the value_pwm_2 picked from the array
analogWrite(ledpin_3, (sinarray[array_tag_3] * max_volts / 100)); // sets the value_pwm_3
analogWrite(ledpin_4, (sinarray[array_tag_4] * max_volts / 100)); // sets the value_pwm_4
analogWrite(ledpin_5, (sinarray[array_tag_5] * max_volts / 100)); // sets the value_pwm_5
analogWrite(ledpin_6, (sinarray[array_tag_6] * max_volts / 100)); // sets the value_pwm_6
if (array_tag_1 < 1074) { // 1074 is the last the last array tag for phase 1 postive, so below that we add 6 to each tag to get to the next spot for each phase in the array
array_tag_1 = array_tag_1 + 6;
array_tag_2 = array_tag_2 + 6;
array_tag_3 = array_tag_3 + 6;
array_tag_4 = array_tag_4 + 6;
array_tag_5 = array_tag_5 + 6;
array_tag_6 = array_tag_6 + 6;
}
else { // after 1074 we reset all the array tags to their original value
digitalWrite (7,HIGH); // I flash an LED to see the completion of each cycle
array_tag_1 = 0; // this resets the array counters back to zero
array_tag_2 = 1;
array_tag_3 = 2;
array_tag_4 = 3;
array_tag_5 = 4;
array_tag_6 = 5;
}
delay(pot_value); // delays and reruns the whole thing after going through each full cycle. I need to be able to due this without delays and with faster PWM
digitalWrite (7,LOW);
}
// 3 phase sin wave output
// by Swamijake
int sinarray [] = {0,0,87,0,0,87,3,0,85,0,0,88,7,0,83,0,0,90,10,0,81,0,0,91,14,0,79,0,0,93,17,0,77,0,0,94,21,0,74,0,0,95,24,0,72,0,0,96,28,0,69,0,0,97,31,0,67,0,0,98,34,0,64,0,0,98,37,0,62,0,0,99,41,0,59,0,0,99,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,100,59,0,41,0,0,99,62,0,37,0,0,99,64,0,34,0,0,98,67,0,31,0,0,98,69,0,28,0,0,97,72,0,24,0,0,96,74,0,21,0,0,95,77,0,17,0,0,94,79,0,14,0,0,93,81,0,10,0,0,91,83,0,7,0,0,90,85,0,3,0,0,88,87,0,0,0,0,87,88,0,0,3,0,85,90,0,0,7,0,83,91,0,0,10,0,81,93,0,0,14,0,79,94,0,0,17,0,77,95,0,0,21,0,74,96,0,0,24,0,72,97,0,0,28,0,69,98,0,0,31,0,67,98,0,0,34,0,64,99,0,0,37,0,62,99,0,0,41,0,59,100,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,99,0,0,59,0,41,99,0,0,62,0,37,98,0,0,64,0,34,98,0,0,67,0,31,97,0,0,69,0,28,96,0,0,72,0,24,95,0,0,74,0,21,94,0,0,77,0,17,93,0,0,79,0,14,91,0,0,81,0,10,90,0,0,83,0,7,88,0,0,85,0,3,87,0,0,87,0,0,85,0,0,88,3,0,83,0,0,90,7,0,81,0,0,91,10,0,79,0,0,93,14,0,77,0,0,94,17,0,74,0,0,95,21,0,72,0,0,96,24,0,69,0,0,97,28,0,67,0,0,98,31,0,64,0,0,98,34,0,62,0,0,99,37,0,59,0,0,99,41,0,56,0,0,100,44,0,53,0,0,100,47,0,50,0,0,100,50,0,47,0,0,100,53,0,44,0,0,100,56,0,41,0,0,99,59,0,37,0,0,99,62,0,34,0,0,98,64,0,31,0,0,98,67,0,28,0,0,97,69,0,24,0,0,96,72,0,21,0,0,95,74,0,17,0,0,94,77,0,14,0,0,93,79,0,10,0,0,91,81,0,7,0,0,90,83,0,3,0,0,88,85,0,0,0,0,87,87,0,0,3,0,85,88,0,0,7,0,83,90,0,0,10,0,81,91,0,0,14,0,79,93,0,0,17,0,77,94,0,0,21,0,74,95,0,0,24,0,72,96,0,0,28,0,69,97,0,0,31,0,67,98,0,0,34,0,64,98,0,0,37,0,62,99,0,0,41,0,59,99,0,0,44,0,56,100,0,0,47,0,53,100,0,0,50,0,50,100,0,0,53,0,47,100,0,0,56,0,44,100,0,0,59,0,41,99,0,0,62,0,37,99,0,0,64,0,34,98,0,0,67,0,31,98,0,0,69,0,28,97,0,0,72,0,24,96,0,0,74,0,21,95,0,0,77,0,17,94,0,0,79,0,14,93,0,0,81,0,10,91,0,0,83,0,7,90,0,0,85,0,3,88,0,0,87,0,0,87,0,0,88,3,0,85,0,0,90,7,0,83,0,0,91,10,0,81,0,0,93,14,0,79,0,0,94,17,0,77,0,0,95,21,0,74,0,0,96,24,0,72,0,0,97,28,0,69,0,0,98,31,0,67,0,0,98,34,0,64,0,0,99,37,0,62,0,0,99,41,0,59,0,0,100,44,0,56,0,0,100,47,0,53,0,0,100,50,0,50,0,0,100,53,0,47,0,0,100,56,0,44,0,0,99,59,0,41,0,0,99,62,0,37,0,0,98,64,0,34,0,0,98,67,0,31,0,0,97,69,0,28,0,0,96,72,0,24,0,0,95,74,0,21,0,0,94,77,0,17,0,0,93,79,0,14,0,0,91,81,0,10,0,0,90,83,0,7,0,0,88,85,0,3,0,0,87,87,0,0,0,0,85,88,0,0,3,0,83,90,0,0,7,0,81,91,0,0,10,0,79,93,0,0,14,0,77,94,0,0,17,0,74,95,0,0,21,0,72,96,0,0,24,0,69,97,0,0,28,0,67,98,0,0,31,0,64,98,0,0,34,0,62,99,0,0,37,0,59,99,0,0,41,0,56,100,0,0,44,0,53,100,0,0,47,0,50,100,0,0,50,0,47,100,0,0,53,0,44,100,0,0,56,0,41,99,0,0,59,0,37,99,0,0,62,0,34,98,0,0,64,0,31,98,0,0,67,0,28,97,0,0,69,0,24,96,0,0,72,0,21,95,0,0,74,0,17,94,0,0,77,0,14,93,0,0,79,0,10,91,0,0,81,0,7,90,0,0,83,0,3,88,0,0,85};
// generated the array in excel, it is 6 outputs (one positive and one negative for each phase) times 180 bins for 2 degree resolution
int pot_value = 0; // input for the potentiometer used to control frequency
int analog_pin = 0; // input pin for pot
int max_volts = 0; // controls amplitude of the sin wave
int analog_volt = 1;
int value_pwm_1 = 0; // variable to keep the actual value_pwm_1
int ledpin_1 = 3; // light connected to digital pin 3
int array_tag_1 = 0; // where to get first value for phase 1 positive from array, first value in array is tagged at 0
int value_pwm_2 = 0; // variable to keep the actual value_pwm_2
int ledpin_2 = 4; // light connected to digital pin 4
int array_tag_2 = 1; // where to get first value for phase 1 negative from array
int value_pwm_3 = 0; // variable to keep the actual value_pwm_2
int ledpin_3 = 12; // light connected to digital pin 12
int array_tag_3 = 2; // where to get first value for phase 2 positive from array
int value_pwm_4 = 0; // variable to keep the actual value_pwm_2
int ledpin_4 = 13; // light connected to digital pin 13
int array_tag_4 = 3; // where to get first value for phase 2 negative from array
int value_pwm_5 = 0; // variable to keep the actual value_pwm_2
int ledpin_5 = 14; // light connected to digital pin 14
int array_tag_5 = 4; // where to get first value for phase 3 positive from array
int value_pwm_6 = 0; // variable to keep the actual value_pwm_2
int ledpin_6 = 15; // light connected to digital pin 15
int array_tag_6 = 5; // where to get first value for phase 3 negative from array
void setup()
{
pinMode(7, OUTPUT); // using an LED on pin 7 to indicate the completion of one complete cycle on phase 1
}
void loop()
{
pot_value = analogRead(analog_pin) / 100; // using a pot to control the frequency
max_volts = analogRead(analog_volt) / 4; // changes the max voltage based on the second pot
analogWrite(ledpin_1, (sinarray[array_tag_1] * max_volts / 100)); // sets the value_pwm_1 picked from the array
analogWrite(ledpin_2, (sinarray[array_tag_2] * max_volts / 100)); // sets the value_pwm_2 picked from the array
analogWrite(ledpin_3, (sinarray[array_tag_3] * max_volts / 100)); // sets the value_pwm_3
analogWrite(ledpin_4, (sinarray[array_tag_4] * max_volts / 100)); // sets the value_pwm_4
analogWrite(ledpin_5, (sinarray[array_tag_5] * max_volts / 100)); // sets the value_pwm_5
analogWrite(ledpin_6, (sinarray[array_tag_6] * max_volts / 100)); // sets the value_pwm_6
if (array_tag_1 < 1074) { // 1074 is the last the last array tag for phase 1 postive, so below that we add 6 to each tag to get to the next spot for each phase in the array
array_tag_1 = array_tag_1 + 6;
array_tag_2 = array_tag_2 + 6;
array_tag_3 = array_tag_3 + 6;
array_tag_4 = array_tag_4 + 6;
array_tag_5 = array_tag_5 + 6;
array_tag_6 = array_tag_6 + 6;
}
else { // after 1074 we reset all the array tags to their original value
digitalWrite (7,HIGH); // I flash an LED to see the completion of each cycle
array_tag_1 = 0; // this resets the array counters back to zero
array_tag_2 = 1;
array_tag_3 = 2;
array_tag_4 = 3;
array_tag_5 = 4;
array_tag_6 = 5;
}
delay(pot_value); // delays and reruns the whole thing after going through each full cycle. I need to be able to due this without delays and with faster PWM
digitalWrite (7,LOW);
}
Subscribe to:
Posts (Atom)