Storing Cookies (See : http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm ) help us to bring you our services at overunity.com . If you use this website and our services you declare yourself okay with using cookies .More Infos here:
https://overunity.com/5553/privacy-policy/
If you do not agree with storing cookies, please LEAVE this website now. From the 25th of May 2018, every existing user has to accept the GDPR agreement at first login. If a user is unwilling to accept the GDPR, he should email us and request to erase his account. Many thanks for your understanding

User Menu

Custom Search

Author Topic: Pierre's 170W in 1600W out Looped Very impressive Build continued & moderated  (Read 423797 times)

TinselKoala

  • Hero Member
  • *****
  • Posts: 13958
My code attached. No refinements or attempts to reduce lines.
Not tested yet.
I have another version for a 36 slot stator, as I have a 10KW motor coming my way.

Regards

L192


// L192 March 2018
// 30 slot stator


const int Enable_1_11_21_5_15_25 = 37;   
const int Enable_2_12_22_6_16_26 = 38;   
const int Enable_3_13_23_7_17_27 = 39;   
const int Enable_4_14_24_8_18_28 = 40;   
const int Enable_5_15_25_9_19_29 =41;   
const int Enable_6_16_26_10_20_30 =42;   
const int Enable_7_17_27_11_21_1 =43;   
const int Enable_8_18_28_12_22_2 =44;   
const int Enable_9_19_29_13_23_3 =45;   
const int Enable_10_20_30_14_24_4 =46;   

   



void setup() {
  // initialize digital pin 1-30 as an output.

 pinMode(1, OUTPUT);
 pinMode(2, OUTPUT);
 pinMode(3, OUTPUT);
 pinMode(4, OUTPUT);
 pinMode(5, OUTPUT);
 pinMode(6, OUTPUT);
 pinMode(7,OUTPUT);
 pinMode(8, OUTPUT);
 pinMode(9, OUTPUT);
 pinMode(10, OUTPUT);
 pinMode(11, OUTPUT);
 pinMode(12, OUTPUT);
 pinMode(13, OUTPUT);
 pinMode(14,OUTPUT);
 pinMode(15, OUTPUT);
 pinMode(16, OUTPUT);
 pinMode(17, OUTPUT);
 pinMode(18, OUTPUT);
 pinMode(19, OUTPUT);
 pinMode(20, OUTPUT);
 pinMode(21, OUTPUT);
 pinMode(22, OUTPUT);
 pinMode(23,OUTPUT);
 pinMode(24, OUTPUT);
 pinMode(25, OUTPUT);
 pinMode(26, OUTPUT);
 pinMode(27, OUTPUT);
 pinMode(28, OUTPUT);
 pinMode(29, OUTPUT);
 pinMode(30,OUTPUT);
   
 //initialize pins 37-46 as an output   
pinMode (Enable_1_11_21_5_15_25,OUTPUT);   
pinMode (Enable_2_12_22_6_16_26,OUTPUT);   
pinMode (Enable_3_13_23_7_17_27,OUTPUT);   
pinMode (Enable_4_14_24_8_18_28,OUTPUT);   
pinMode (Enable_5_15_25_9_19_29,OUTPUT);   
pinMode (Enable_6_16_26_10_20_30,OUTPUT);   
pinMode (Enable_7_17_27_11_21_1,OUTPUT);   
pinMode (Enable_8_18_28_12_22_2,OUTPUT);   
pinMode (Enable_9_19_29_13_23_3,OUTPUT);   
pinMode (Enable_10_20_30_14_24_4,OUTPUT);   
   
}

int x = 0;


void loop(){
 //int y= analogRead(0); // read pot  use this if you want or set x manually
 // x= map(y,0,1000 ,1,100);
x=1000;

// sequencing 30 coils 5 slot pitch previous coil stays on until next coil is on
  digitalWrite(1,HIGH), digitalWrite(11,HIGH), digitalWrite(21,HIGH); //top switches   
  digitalWrite(5,LOW), digitalWrite(15,LOW), digitalWrite(25,LOW);   // bottom switches
  digitalWrite (Enable_1_11_21_5_15_25,HIGH); //enable all switches in group setting output
  delay(x);              // wait for a second
 
  digitalWrite(2,HIGH), digitalWrite(12,HIGH), digitalWrite(22,HIGH); // top switches ON before 1 OFF
  digitalWrite(6,LOW), digitalWrite(16,LOW), digitalWrite(26,LOW); // bottom switches ON before 1 OFF
  digitalWrite(Enable_2_12_22_6_16_26,HIGH); //enable all switches in group setting output
  delay(x);              // wait for a second
  digitalWrite(Enable_1_11_21_5_15_25,LOW); //disable all switches in group 1 OFF
  delay(x);              // wait for a second
 
  digitalWrite(3,HIGH), digitalWrite(13,HIGH), digitalWrite(22,HIGH);   // top swtches ON before 2 OFF
  digitalWrite(7,LOW), digitalWrite(17,LOW), digitalWrite(27,LOW);   // bottom switches ON before 2 OFF
  digitalWrite(Enable_3_13_23_7_17_27,HIGH); //enable all switches in group setting output
  delay(x);              // wait for a second
  digitalWrite(Enable_2_12_22_6_16_26,LOW); //disable all switches in group 2 OFF
  delay(x);              // wait for a second
 
  digitalWrite(4,HIGH), digitalWrite(14,HIGH), digitalWrite(24,HIGH); // top switches
  digitalWrite(8,LOW), digitalWrite(18,LOW), digitalWrite(28,LOW);   // bottom switches
  digitalWrite(Enable_4_14_24_8_18_28,HIGH); //enable all switches in group
  delay(x);              // wait for a second
  digitalWrite(Enable_3_13_23_7_17_27,LOW); //disable all switches in group
  delay(x);              // wait for a second
 
  digitalWrite(5,HIGH), digitalWrite(15,HIGH), digitalWrite(25,HIGH);   // top switches
  digitalWrite(9,LOW), digitalWrite(19,LOW), digitalWrite(29,LOW);   // bottom switches
  digitalWrite(Enable_5_15_25_9_19_29,HIGH); //enable all switches in group
  delay(x);              // wait for a second
  digitalWrite(Enable_4_14_24_8_18_28,LOW); //disable all switches in group
  delay(x);              // wait for a second
 
  digitalWrite(6,HIGH), digitalWrite(16,HIGH), digitalWrite(26,HIGH); // top switches
  digitalWrite(10,LOW), digitalWrite(20,LOW), digitalWrite(30,LOW);   // bottom switches
  digitalWrite(Enable_6_16_26_10_20_30,HIGH); //enable all switches in group
  delay(x);              // wait for a second
  digitalWrite(Enable_5_15_25_9_19_29,LOW); //disable all switches in group
  delay(x);              // wait for a second
 
  digitalWrite(7,HIGH), digitalWrite(17,HIGH), digitalWrite(27,HIGH);   // top switches
  digitalWrite(11,LOW), digitalWrite(21,LOW), digitalWrite(1,LOW);   // bottom switches
  digitalWrite(Enable_7_17_27_11_21_1,HIGH); //enable all switches in group
  delay(x);              // wait for a second
  digitalWrite(Enable_6_16_26_10_20_30,LOW); //disable all switches in group
  delay(x);              // wait for a second
 
  digitalWrite(8,HIGH), digitalWrite(18,HIGH), digitalWrite(28,HIGH); // top switches
  digitalWrite(12,LOW), digitalWrite(22,LOW), digitalWrite(2,LOW);   // bottom switches
  digitalWrite(Enable_8_18_28_12_22_2,HIGH); //enable all switches in group
  delay(x);              // wait for a second
  digitalWrite(Enable_7_17_27_11_21_1,LOW); //disable all switches in group
  delay(x);              // wait for a second
 
  digitalWrite(9,HIGH), digitalWrite(19,HIGH), digitalWrite(29,HIGH);   // top switches
  digitalWrite(13,LOW), digitalWrite(23,LOW), digitalWrite(3,LOW);   // bottom switches
  digitalWrite(Enable_9_19_29_13_23_3,HIGH); //enable all switches in group
  delay(x);              // wait for a second
  digitalWrite(Enable_8_18_28_12_22_2,LOW); //disable all switches in group
  delay(x);              // wait for a second
 
  digitalWrite(10,HIGH), digitalWrite(20,HIGH), digitalWrite(30,HIGH); // top switches
  digitalWrite(14,LOW), digitalWrite(24,LOW), digitalWrite(4,LOW);   // bottom switches
  digitalWrite(Enable_10_20_30_14_24_4,HIGH); //enable all switches in group
  delay(x);              // wait for a second
  digitalWrite(Enable_9_19_29_13_23_3,LOW); //disable all switches in group
  delay(x);              // wait for a second
  digitalWrite(Enable_10_20_30_14_24_4,LOW); //enable all switches in group
  delay(x);

Ah... OK.... But...

1. Your code doesn't compile, because of a minor error: you left off the closing curly bracket in loop(). Once this is fixed the code compiles and runs... But...

2. There is a timing irregularity. This was also there in the original sketch Pierre proposed and I don't recall ever getting a straight answer about whether this was intentional on his part (the "Secret") or a mistake (the "bug"). At any rate it interferes with the smooth flow of the fields around the stator. To be specific, there are two "delay" intervals between "Enable_1x, HIGH" and "Enable_1x, LOW" and also between "Enable_10x, HIGH" and "Enable_10x, LOW", whereas there are three "delay" intervals between all the other "Enable_" HIGH and LOW statements. If this is intentional, fine, but it would be nice to know why.

3. It is far better IMHO (for debugging and actual running, since the desired loop speed is so low) to include setting the "delay" interval value each time it is used, via the potentiometer, rather than setting it once per loop. So I'd recommend replacing each "delay(x)" statement with "delay(map(analogRead(A0), 0, 1023, 0, 100))" so that the speed can be set without having to wait for the loop to finish. This adds some tiny microseconds to the execution time but compared to the "60 Hz" output speed this is insignificant.

4. In my testing it looks like this code has several more "overlaps" than previous versions. That is, instead of just two LEDs lit at any time, this has groups of 5 or 6 chasing around. My test board doesn't have all 30 LED positions populated though; I am only looking at the first "thirdrant" of the complete circle (Pins 1 - 12) , so I'm not seeing the full picture in my hardware test.

pmgr

  • Full Member
  • ***
  • Posts: 184
    • Stop organ harvesting from Falun Gong practitioners
To shed some more light on the coil winding pattern from Pierre, I went back to my old post:

For Pierre's case, I think we need to get clarification from him how exactly he has wound the stator. What I assumed in my latest simulations is that a coil runs over 7 slots and the next coil is in the neighboring slot (see my number sequence above).

01-07 08-14 15-21 22-28 29-35 36-06
07-13 14-20 21-27 28-34 35-05 06-12
13-19 20-26 27-33 34-04 05-11 12-18
19-25 26-32 33-03 04-10 11-17 18-24
25-31 32-02 03-09 10-16 17-23 24-30
31-01 02-08 09-05 16-22 23-29 30-36

36 coils total, so he could be using this winding configuration. The magnetic field pattern is attached (7SlotCoilSpan).

Yet he could also have done it like this: spanning 7 slots and have the neighboring coils in the same slot, then he would get the following sequence:

01-07 07-13 13-19 19-25 25-31 31-01
02-08 08-14 14-20 20-26 26-32 32-02
03-09 09-15 15-21 21-27 27-33 33-03
04-10 10-16 16-22 22-28 28-34 34-04
05-11 11-17 17-23 23-29 29-35 35-05
06-12 12-18 18-24 24-30 30-36 36-06

This actually yields the same coil configuration as the previous configuration (yet in different order, but that doesn't matter).
So again, 36 total coils, so he could be using this configuration.

So let's look now at a coil span of 6 slots instead of 7:

01-06 07-12 13-18 19-24 25-30 31-36
02-07 08-13 14-19 20-25 26-31 32-01
03-08 09-14 15-20 21-26 27-32 33-02
04-09 10-15 16-21 22-27 28-33 34-03
05-10 11-16 17-22 23-28 29-34 35-04
06-11 12-17 18-23 24-29 30-35 36-05

Again 2 coils per slot and 36 coils total, so he could be using this as well. I note that his one has his magic number sequence 01-06 ; 02-07; 03-08, etc. see post #170. For the magnetic field, see the attached image (6SlotCoilSpan).

Let's see if he could have done it like this: spanning 6 slots and have the neighboring coils in the same slot, then he would get the following sequence:

01-06 06-11 11-16 16-21 21-26 26-31 31-36
36-04 04-09 09-14 14-19 19-24 24-29 29-34
34-03 03-08 08-13 13-18 18-23 23-28 28-33
33-02 02-07 07-12 12-17 17-22 22-27 27-32
32-01

However this only gives 29 coils, so he can't have used this.

Someone should ask him what he is using.

PmgR

====
* Truthfulness * Compassion * Forbearance * www.falundafa.org

TinselKoala

  • Hero Member
  • *****
  • Posts: 13958
I've "massaged" listener191's code a little bit to get rid of the timing glitch (assuming it is unintentional), fix an error in comments, add the realtime speed control, etc.

I haven't been able to figure out how to compress the 10 coil-actuation statement sets into a single loop yet, but I'm sure it can be done.

Please, Stefan or moderators... can you enable the "code" BBTag?

-----------------------------------------------------------------------------------------------------------------------------------


/**********************************

   L192 March 2018
   30 slot stator
   
   massaged by TK:
   -- timing irregularity fixed
   -- for loop added
   -- Enable[] group array added
   -- Speed adjust real-time added



**********************************/
const int Enable[] = { 37,38,39,40,41,42,43,44,45,46 };  // Enable pins for coil groups 1-10

/*
Enable[1] group controls coils _1_11_21_5_15_25 
Enable[2] group controls coils _2_12_22_6_16_26   
Enable[3] group controls coils _3_13_23_7_17_27 
Enable[4] group controls coils _4_14_24_8_18_28 
Enable[5] group controls coils _5_15_25_9_19_29
Enable[6] group controls coils _6_16_26_10_20_30
Enable[7] group controls coils _7_17_27_11_21_1
Enable[8] group controls coils _8_18_28_12_22_2
Enable[9] group controls coils _9_19_29_13_23_3
Enable[10] group controls coils _10_20_30_14_24_4
*/

int pincounter = 1;
int index = 1;
int maxDelay = 100;  // set maximum delay interval in milliseconds here

void setup() {
  // initialize digital pin 1-30 as an output.
 for (pincounter = 1; pincounter < 31; pincounter ++) {
 pinMode(pincounter, OUTPUT);
 }
 pinMode(A0, INPUT);
}

void loop() {

  // sequencing 30 coils 5 slot pitch previous coil stays on until next coil is on
  digitalWrite(1,HIGH), digitalWrite(11,HIGH), digitalWrite(21,HIGH); //top switches   
  digitalWrite(5,LOW), digitalWrite(15,LOW), digitalWrite(25,LOW);    // bottom switches
  digitalWrite (Enable[1], HIGH); // enable all switches in group 1
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[10],LOW);  // disable all switches in group 10
  delay(map(analogRead(A0),0,1023,0,maxDelay));
 
  digitalWrite(2,HIGH), digitalWrite(12,HIGH), digitalWrite(22,HIGH); // top switches ON before 1 OFF
  digitalWrite(6,LOW), digitalWrite(16,LOW), digitalWrite(26,LOW);    // bottom switches ON before 1 OFF
  digitalWrite (Enable[2], HIGH);  // enable all switches in group 2
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[1], LOW);  // disable all switches in group 1
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(3,HIGH), digitalWrite(13,HIGH), digitalWrite(22,HIGH); // top switches ON before 2 OFF
  digitalWrite(7,LOW), digitalWrite(17,LOW), digitalWrite(27,LOW);    // bottom switches ON before 2 OFF
  digitalWrite (Enable[3], HIGH);  // enable all switches in group 3
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[2],LOW);   // disable all switches in group 2
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(4,HIGH), digitalWrite(14,HIGH), digitalWrite(24,HIGH);  // top switches
  digitalWrite(8,LOW), digitalWrite(18,LOW), digitalWrite(28,LOW);     // bottom switches
  digitalWrite (Enable[4], HIGH);  // enable all switches in group 4
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[3],LOW);   // disable all switches in group 3
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(5,HIGH), digitalWrite(15,HIGH), digitalWrite(25,HIGH);  // top switches
  digitalWrite(9,LOW), digitalWrite(19,LOW), digitalWrite(29,LOW);     // bottom switches
  digitalWrite (Enable[5], HIGH);  // enable all switches in group 5
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[4],LOW);   // disable all switches in group 4
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(6,HIGH), digitalWrite(16,HIGH), digitalWrite(26,HIGH);  // top switches
  digitalWrite(10,LOW), digitalWrite(20,LOW), digitalWrite(30,LOW);    // bottom switches
  digitalWrite (Enable[6],HIGH); // enable all switches in group 6
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[5],LOW);   // disable all switches in group 5
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(7,HIGH), digitalWrite(17,HIGH), digitalWrite(27,HIGH);   // top switches
  digitalWrite(11,LOW), digitalWrite(21,LOW), digitalWrite(1,LOW);      // bottom switches
  digitalWrite (Enable[7],HIGH);  // enable all switches in group 7
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[6],LOW);  // disable all switches in group 6
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(8,HIGH), digitalWrite(18,HIGH), digitalWrite(28,HIGH);   // top switches
  digitalWrite(12,LOW), digitalWrite(22,LOW), digitalWrite(2,LOW);      // bottom switches
  digitalWrite (Enable[8],HIGH);  // enable all switches in group 8
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[7],LOW);   // disable all switches in group 7
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(9,HIGH), digitalWrite(19,HIGH), digitalWrite(29,HIGH);   // top switches
  digitalWrite(13,LOW), digitalWrite(23,LOW), digitalWrite(3,LOW);      // bottom switches
  digitalWrite (Enable[9],HIGH);  // enable all switches in group 9
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[8],LOW);   // disable all switches in group 8
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(10,HIGH), digitalWrite(20,HIGH), digitalWrite(30,HIGH); // top switches
  digitalWrite(14,LOW), digitalWrite(24,LOW), digitalWrite(4,LOW);     // bottom switches
  digitalWrite (Enable[10],HIGH); // enable all switches in group 10
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[9],LOW);   // disable all switches in group 9
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 }

listener191

  • Sr. Member
  • ****
  • Posts: 253
To shed some more light on the coil winding pattern from Pierre, I went back to my old post:

For Pierre's case, I think we need to get clarification from him how exactly he has wound the stator. What I assumed in my latest simulations is that a coil runs over 7 slots and the next coil is in the neighboring slot (see my number sequence above).

01-07 08-14 15-21 22-28 29-35 36-06
07-13 14-20 21-27 28-34 35-05 06-12
13-19 20-26 27-33 34-04 05-11 12-18
19-25 26-32 33-03 04-10 11-17 18-24
25-31 32-02 03-09 10-16 17-23 24-30
31-01 02-08 09-05 16-22 23-29 30-36

36 coils total, so he could be using this winding configuration. The magnetic field pattern is attached (7SlotCoilSpan).

Yet he could also have done it like this: spanning 7 slots and have the neighboring coils in the same slot, then he would get the following sequence:

01-07 07-13 13-19 19-25 25-31 31-01
02-08 08-14 14-20 20-26 26-32 32-02
03-09 09-15 15-21 21-27 27-33 33-03
04-10 10-16 16-22 22-28 28-34 34-04
05-11 11-17 17-23 23-29 29-35 35-05
06-12 12-18 18-24 24-30 30-36 36-06

This actually yields the same coil configuration as the previous configuration (yet in different order, but that doesn't matter).
So again, 36 total coils, so he could be using this configuration.

So let's look now at a coil span of 6 slots instead of 7:

01-06 07-12 13-18 19-24 25-30 31-36
02-07 08-13 14-19 20-25 26-31 32-01
03-08 09-14 15-20 21-26 27-32 33-02
04-09 10-15 16-21 22-27 28-33 34-03
05-10 11-16 17-22 23-28 29-34 35-04
06-11 12-17 18-23 24-29 30-35 36-05

Again 2 coils per slot and 36 coils total, so he could be using this as well. I note that his one has his magic number sequence 01-06 ; 02-07; 03-08, etc. see post #170. For the magnetic field, see the attached image (6SlotCoilSpan).

Let's see if he could have done it like this: spanning 6 slots and have the neighboring coils in the same slot, then he would get the following sequence:

01-06 06-11 11-16 16-21 21-26 26-31 31-36
36-04 04-09 09-14 14-19 19-24 24-29 29-34
34-03 03-08 08-13 13-18 18-23 23-28 28-33
33-02 02-07 07-12 12-17 17-22 22-27 27-32
32-01

However this only gives 29 coils, so he can't have used this.

Someone should ask him what he is using.

PmgR

====
* Truthfulness * Compassion * Forbearance * www.falundafa.org

Hi PmgR,

This was posted a few posts back.

Shows Pierre's coil pitch was 6 slots, so I favour..

01-06 07-12 13-18 19-24 25-30 31-36
02-07 08-13 14-19 20-25 26-31 32-01
03-08 09-14 15-20 21-26 27-32 33-02
04-09 10-15 16-21 22-27 28-33 34-03
05-10 11-16 17-22 23-28 29-34 35-04
06-11 12-17 18-23 24-29 30-35 36-05


Regards

L192
(http://overunity.com/17653/pierres-170w-in-1600w-out-looped-very-impressive-build-continued-moderated/dlattach/attach/167187/image//)

r2fpl

  • Hero Member
  • *****
  • Posts: 744
Pierre connection:

simple connection 2 coils together.
« Last Edit: April 01, 2018, 12:32:29 PM by r2fpl »

listener191

  • Sr. Member
  • ****
  • Posts: 253
Regarding the L298N temperature rise.

In the test I conducted, I was using the high side transistor pair of OUT1&2 and  the low side transistor pair of OUT3&4, so both half bridges of the L298N were in conduction.
If you move the low switch to another board, then you change the thermal duty cycle of the device, as both half bridges will not be in conduction.

Although the device die is rated to 130 deg C, I would not want to run the heat sinked device over 75deg C, as thermal shutdown occurs some where between 80-85 deg C. 

I set up a test with a 1 in 6 pulse duty cycle, with the high side and low side switches on different boards. 4A peak was achieved with a 38 deg C temp on the heatsink continuous running..so this is the way to go.

Another point ..the high side switch appears to be dropping about 8V at 4A and the low side switch about 4V. MOSFET's would not have this problem .

Regards
L192

listener191

  • Sr. Member
  • ****
  • Posts: 253
That looks like an excellent wiring job L192.
Can you post a front few picture (like below) with rotor in place.
Thanks for sharing your great work
Luc

Hi Gotoluc,

Here is an end shot of the stator and rotor.

Note my coils are a little longer than I planned but they were wound for a 6 slot pitch in a slightly bigger stator.
I didnt want to wind up another set or spend time changing these so they would be tighter.

The rotor covers 9 poles, so induction will be over a wider range of arc.

You can see that more than 36T x 2 could have been packed in these slots, perhaps 46T.

Regards

L192

Cherryman

  • Hero Member
  • *****
  • Posts: 642
TK, i think there is a minor mistake in your sketch.


Arrays are zero indexed, that is the first element of the array is at index 0 (zero)


Taken that in to account i changed your code a little.


-----------------------------------------------------------------------------------------------------------------------------------


/**********************************

   L192 March 2018
   30 slot stator
   
   manicured by CM
   massaged by TK:
   -- timing irregularity fixed
   -- for loop added
   -- Enable[] group array added
   -- Speed adjust real-time added



**********************************/
const int Enable[] = { 37,38,39,40,41,42,43,44,45,46 };  // Enable pins for coil groups 1-10

/*
Enable[0] group controls coils _1_11_21_5_15_25 
Enable[1] group controls coils _2_12_22_6_16_26   
Enable[2] group controls coils _3_13_23_7_17_27 
Enable[3] group controls coils _4_14_24_8_18_28 
Enable[4] group controls coils _5_15_25_9_19_29
Enable[5] group controls coils _6_16_26_10_20_30
Enable[6] group controls coils _7_17_27_11_21_1
Enable[7] group controls coils _8_18_28_12_22_2
Enable[8] group controls coils _9_19_29_13_23_3
Enable[9] group controls coils _10_20_30_14_24_4
*/

int pincounter = 1;
int index = 1;
int maxDelay = 100;  // set maximum delay interval in milliseconds here

void setup() {
  // initialize digital pin 1-30 as an output.
 for (pincounter = 1; pincounter < 31; pincounter ++) {
 pinMode(pincounter, OUTPUT);
 }
 pinMode(A0, INPUT);
}

void loop() {

  // sequencing 30 coils 5 slot pitch previous coil stays on until next coil is on
  digitalWrite(1,HIGH), digitalWrite(11,HIGH), digitalWrite(21,HIGH); //top switches   
  digitalWrite(5,LOW), digitalWrite(15,LOW), digitalWrite(25,LOW);    // bottom switches
  digitalWrite (Enable[0], HIGH); // enable all switches in group 1
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[9],LOW);  // disable all switches in group 10
  delay(map(analogRead(A0),0,1023,0,maxDelay));
 
  digitalWrite(2,HIGH), digitalWrite(12,HIGH), digitalWrite(22,HIGH); // top switches ON before 1 OFF
  digitalWrite(6,LOW), digitalWrite(16,LOW), digitalWrite(26,LOW);    // bottom switches ON before 1 OFF
  digitalWrite (Enable[1], HIGH);  // enable all switches in group 2
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[0], LOW);  // disable all switches in group 1
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(3,HIGH), digitalWrite(13,HIGH), digitalWrite(22,HIGH); // top switches ON before 2 OFF
  digitalWrite(7,LOW), digitalWrite(17,LOW), digitalWrite(27,LOW);    // bottom switches ON before 2 OFF
  digitalWrite (Enable[2], HIGH);  // enable all switches in group 3
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[1],LOW);   // disable all switches in group 2
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(4,HIGH), digitalWrite(14,HIGH), digitalWrite(24,HIGH);  // top switches
  digitalWrite(8,LOW), digitalWrite(18,LOW), digitalWrite(28,LOW);     // bottom switches
  digitalWrite (Enable[3], HIGH);  // enable all switches in group 4
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[2],LOW);   // disable all switches in group 3
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(5,HIGH), digitalWrite(15,HIGH), digitalWrite(25,HIGH);  // top switches
  digitalWrite(9,LOW), digitalWrite(19,LOW), digitalWrite(29,LOW);     // bottom switches
  digitalWrite (Enable[4], HIGH);  // enable all switches in group 5
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[3],LOW);   // disable all switches in group 4
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(6,HIGH), digitalWrite(16,HIGH), digitalWrite(26,HIGH);  // top switches
  digitalWrite(10,LOW), digitalWrite(20,LOW), digitalWrite(30,LOW);    // bottom switches
  digitalWrite (Enable[5],HIGH); // enable all switches in group 6
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[4],LOW);   // disable all switches in group 5
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(7,HIGH), digitalWrite(17,HIGH), digitalWrite(27,HIGH);   // top switches
  digitalWrite(11,LOW), digitalWrite(21,LOW), digitalWrite(1,LOW);      // bottom switches
  digitalWrite (Enable[6],HIGH);  // enable all switches in group 7
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[5],LOW);  // disable all switches in group 6
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(8,HIGH), digitalWrite(18,HIGH), digitalWrite(28,HIGH);   // top switches
  digitalWrite(12,LOW), digitalWrite(22,LOW), digitalWrite(2,LOW);      // bottom switches
  digitalWrite (Enable[7],HIGH);  // enable all switches in group 8
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[6],LOW);   // disable all switches in group 7
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(9,HIGH), digitalWrite(19,HIGH), digitalWrite(29,HIGH);   // top switches
  digitalWrite(13,LOW), digitalWrite(23,LOW), digitalWrite(3,LOW);      // bottom switches
  digitalWrite (Enable[8],HIGH);  // enable all switches in group 9
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[7],LOW);   // disable all switches in group 8
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 
  digitalWrite(10,HIGH), digitalWrite(20,HIGH), digitalWrite(30,HIGH); // top switches
  digitalWrite(14,LOW), digitalWrite(24,LOW), digitalWrite(4,LOW);     // bottom switches
  digitalWrite (Enable[9],HIGH); // enable all switches in group 10
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
  digitalWrite(Enable[8],LOW);   // disable all switches in group 9
  delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
 }


TinselKoala

  • Hero Member
  • *****
  • Posts: 13958
Right you are, thanks, so I've incorporated your correction into the current "looped" version here. I managed to compress the ten group switch sequences into one loop, I think. The performance looks the same on my test hardware as the unlooped version above.

---------------------------------------------------------------------------------



/**********************************
 *
 * L192 March 2018
 * 30 slot stator
 *
 * massaged by TK:
 * -- timing irregularity fixed
 * -- for loop added
 * -- Enable[] group array added
 * -- Speed adjust real-time added
 * -- groups looped
 *
 * --corrected by CM for array index
 *
 *
 **********************************/

const int Enable[] = { 37,38,39,40,41,42,43,44,45,46 };  // Enable pins for coil groups 1-10

/*
Enable[0] group controls coils _1_11_21_5_15_25 
 Enable[1] group controls coils _2_12_22_6_16_26   
 Enable[2] group controls coils _3_13_23_7_17_27 
 Enable[3] group controls coils _4_14_24_8_18_28 
 Enable[4] group controls coils _5_15_25_9_19_29
 Enable[5] group controls coils _6_16_26_10_20_30
 Enable[6] group controls coils _7_17_27_11_21_1
 Enable[7] group controls coils _8_18_28_12_22_2
 Enable[8] group controls coils _9_19_29_13_23_3
 Enable[9] group controls coils _10_20_30_14_24_4
 */

int pincounter = 1;
int index = 1;
int maxDelay = 500;  // set maximum delay interval in milliseconds here

void setup() {
  // initialize digital pin 1-30 as an output
  for (pincounter = 1; pincounter < 31; pincounter ++) {
    pinMode(pincounter, OUTPUT);
  }
  pinMode(A0, INPUT);
 // initialize digital pins in Enable[] as output
  for (index = 0; index <10; index ++){
    pinMode(Enable[index],OUTPUT);
  }
}

void loop() {
  for (index=1; index<11; index ++){
    digitalWrite(index,HIGH), digitalWrite(index+10,HIGH), digitalWrite(index+20,HIGH); //top switches   
    digitalWrite(index+4,LOW), digitalWrite(index+14,LOW), digitalWrite((index+24)%30,LOW);    // bottom switches
    digitalWrite (Enable[index-1], HIGH); // enable all switches in group 0
    delay(map(analogRead(A0),0,1023,0,maxDelay));   // read speedpot and wait
    digitalWrite(Enable[(index+8)%10],LOW);  // disable all switches in group 9
    delay(map(analogRead(A0),0,1023,0,maxDelay));
  }
}

Cherryman

  • Hero Member
  • *****
  • Posts: 642
That's a nice solution.


Although it compiles, i'm not sure about the following
You might want to look at the second last line of your code, the format differs from the first time you used it, it looks like typo's, but as it seems to work... i might be missing something.

digitalWrite (Enable[index-1], HIGH); // enable all switches in group 0
digitalWrite(Enable[(index+8)%10],LOW);  // disable all switches in group 9

And a little typo here i think?:

digitalWrite(index+4,LOW), digitalWrite(index+14,LOW), digitalWrite((index+24)%30,LOW);    // bottom switches


Or am i missing the function of the % ?  I'm not thát familiar with Arduino coding. Still learning myself.
Maybe it is the forum that changes it while copy-pasting? 



But my guess would be for the loop:



void loop()
{
  for (index = 1; index < 11; index ++)
 {
    digitalWrite (index, HIGH), digitalWrite(index + 10, HIGH), digitalWrite(index + 20, HIGH);           // top switches
    digitalWrite (index + 4, LOW), digitalWrite(index + 14, LOW), digitalWrite(index + 24, LOW);        // bottom switches
    digitalWrite (Enable[index - 1], HIGH);                                                                                      // enable all switches in group 0
    delay(map(analogRead(A0), 0, 1023, 0, maxDelay));                                                                 // read speedpot and wait
    digitalWrite (Enable[index + 8], LOW);                                                                                      // disable all switches in group 9
    delay(map(analogRead(A0), 0, 1023, 0, maxDelay));
  }
}

Jeg

  • Hero Member
  • *****
  • Posts: 1532
Hi Gotoluc,

Here is an end shot of the stator and rotor.


Great skills great job L192!
What is your wire gauge?

Jeg

ps. TK/Cherryman nice work guys, thanks fore these programming lessons.  ;)


r2fpl

  • Hero Member
  • *****
  • Posts: 744
Possible relays Pierre
« Last Edit: April 01, 2018, 04:23:37 PM by r2fpl »

listener191

  • Sr. Member
  • ****
  • Posts: 253
Great skills great job L192!
What is your wire gauge?

Jeg

ps. TK/Cherryman nice work guys, thanks fore these programming lessons.  ;)


Hi Jeg,


I just checked and it 0.53mm which is 23AWG rated at about 5A continuous at a nominal temperature. The wire is is rated to 160 deg C, so it could be run beyond 5A.

 I had plenty of this gauge and also 0.8mm which is closer to 20AWG.

The slot CSA would accommodate 0.8mm however it would be tight getting the wire pass the pole ends.

Regards

L192

Jeg

  • Hero Member
  • *****
  • Posts: 1532

Hi Jeg,


I just checked and it 0.53mm which is 23AWG rated at about 5A continuous at a nominal temperature. The wire is is rated to 160 deg C, so it could be run beyond 5A.

 I had plenty of this gauge and also 0.8mm which is closer to 20AWG.

The slot CSA would accommodate 0.8mm however it would be tight getting the wire pass the pole ends.

Regards

L192

Thanks a lot for the info. I am to order some wire as i have plenty of 0.4mm which seems to be very thin for this job.
In the meanwhile, after some searching, and after balancing between cost and power characteristics, i ended up with transistors bd911/912 (http://www.st.com/resource/en/datasheet/bd911.pdf) for low and high side switches, and tip120 for driving them through my arduino. Total cost not over 60euros. If i was sure that mosfets can do the job, i would go with them even if i need nearly 120Euros for the boards.

listener191

  • Sr. Member
  • ****
  • Posts: 253
This shot gives  an idea of what you get out on the rotor for 3A pk input on six aligned coils. There was a 25 Watt load on the rotor coils (230V winding on original generator).
4.5A obtained by bring the rail above 35V for a short period double the peak output voltage from 120V to 240V.

Of course the opposite 6 coils (opposite polarity) were not present so I would expect less induction. If they were present this would bring the output up to around 480V peak, assuming just over 3A through each set of coils.

Regards

L192