Skip to content
Snippets Groups Projects
Commit d2b9226f authored by Will Langford's avatar Will Langford
Browse files

reorganizing

parent 73339c15
No related branches found
No related tags found
No related merge requests found
Pipeline #
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.17/marked.min.js"></script>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<style>
.center {
display: block;
margin-left: auto;
margin-right: auto;
}
img {.center}
</style>
</head>
<xmp id="content" theme="github" style="display:none;">
</xmp>
<script>
$('#content').load("readme.md", function() {
// $.getScript("../strapdown.js");
var s = document.createElement("script");
s.type = "text/javascript";
s.src = "../strapdown/strapdown.js";
$("head").append(s);
});
</script>
</html>
\ No newline at end of file
## Pulse Generator Design
### The Waveform
I've had some email correspondance with Jaako Fagerlund (who is one of the few people who has made his own desktop EDM) and he had a really nice explanation of how the waveform should work:
<div align="center">
<img src="../images/waveform.jpg">
</div>
> The waveform is quite simplified in that picture, but it explains the basics very well. Looking at the upper graph you see gap voltage versus time. As the voltage is switched on, the voltage in the gap is the same as the generators output. If the gap is small enough, the dielectric breaks down and a spark is ignited. This plasma channel is of course lower resistance, so now current (lower graph) starts to flow. The gap voltage drops to basically what the plasma channels resistance times current is. In the graph this area is the lower voltage after full (open) voltage. Then after the on time pulse length is achieved, the generator switches of, the current flow stops and the gap voltage is zero until the generator once again applies a new pulse.
Based on this, this is the basic circuit schematic that I'm after:
<img src="../images/basic_schematic.jpg" width="600px" class="center">
With a few more details filled in:
<img src="../images/annotated_schematic.jpg" width="600px" class="center">
My understanding of the waveform:
<img src="../images/waveforms.jpg" width="600px" class="center">
### References:
- [All the ways to drive high-side switches](http://www.ti.com/lit/ml/slua618/slua618.pdf)
......
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.17/marked.min.js"></script>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<style>
.center {
display: block;
margin-left: auto;
margin-right: auto;
}
img {.center}
</style>
</head>
<xmp id="content" theme="github" style="display:none;">
</xmp>
<script>
$('#content').load("readme.md", function() {
// $.getScript("../strapdown.js");
var s = document.createElement("script");
s.type = "text/javascript";
s.src = "../strapdown/strapdown.js";
$("head").append(s);
});
</script>
</html>
\ No newline at end of file
......@@ -99,9 +99,9 @@ int main(void) {
// configure pins
ledPort.DIRSET = ledPin; //led
PORTC.OUTSET = txPin; //tx
PORTC.DIRSET = txPin; //tx
PORTC.DIRCLR = rxPin; //rx
serialPort.OUTSET = txPin; //tx
serialPort.DIRSET = txPin; //tx
serialPort.DIRCLR = rxPin; //rx
// setup USART
USART_InterruptDriver_Initialize(&USART_data, &USARTC0, USART_DREINTLVL_LO_gc);
......@@ -114,11 +114,10 @@ int main(void) {
USART_Tx_Enable(USART_data.usart);
// setup pwm
chargePort.DIR |= ledPin;
TCC0.PER = 0x0400; //set up 4096 resolution
TCC0.CTRLB |= TC_WGMODE_SS_gc;//( TCC0.CTRLB & ~TC0_WGMODE_gm ) | TC_WGMODE_SS_gc; //single slope
TCC0.CTRLB |= TC0_CCBEN_bm; //& ( TC0_CCAEN_bm | TC0_CCBEN_bm | TC0_CCCEN_bm | TC0_CCDEN_bm ); //enable compare channel
TCC0.CTRLA |= TC_CLKSEL_DIV2_gc; //set clock divider
TCC0.PER = 0x0400; //set up 1024 resolution
TCC0.CTRLB |= TC_WGMODE_SS_gc; //single slope
TCC0.CTRLB |= TC0_CCBEN_bm; //enable compare channel on OC0B
TCC0.CTRLA |= TC_CLKSEL_DIV2_gc; //set clock divider to /2 (16 KHz)
set_pwm(512);
// enable interrupts
......
......@@ -2,9 +2,11 @@
### Programming
on linux needed to install libusb-dev: `sudo apt-get install libusb-dev`
The Xmega doesn't work right out of the box. It needs some updated avr-gcc and libusb installs:
on osx, needed to install updated avr-gcc and avrdude:
On linux, I needed to install libusb-dev: `sudo apt-get install libusb-dev`
On osx, I needed to install updated avr-gcc and avrdude:
`brew tap osx-cross/avr`
......@@ -12,11 +14,11 @@ on osx, needed to install updated avr-gcc and avrdude:
`brew install avrdude`
In my case, I also had to overwrite existing links:
In my case, I also had to overwrite existing links: (Be careful with this if you care about your avr-gcc/avrdude install… Mine was pretty broken to begin with so I had no problem replacing them.)
`brew link --overwrite avrdude`
`brew link --overwrite avrc-gcc`
`brew link --overwrite avr-gcc`
`brew link --overwrite avr-binutils `
......@@ -24,7 +26,7 @@ Then I got the usbdev_open() error that Sam also encountered on OS X. I followed
### [Clocks](blink/)
should be able to setup a 48MHz clock using the internal PLL like so:
I should be able to setup a 48MHz clock using the internal PLL like so:
```C
OSC.PLLCTRL = OSC_PLLFAC4_bm | OSC_PLLFAC3_bm; // 2 MHz * 24 = 48 MHz
......@@ -34,9 +36,13 @@ CCP = CCP_IOREG_gc; // enable protected register change
CLK.CTRL = CLK_SCLKSEL_PLL_gc; // switch to PLL
```
but this seems to go almost 2x too fast.
but this seems to go almost 2x too fast. To say this more precisely, I'm guessing the delay is using the 32MHz F_CPU constant and not the updated 48MHz (which would mean it's precisely 48/32 or 1.5x too fast). I can check the actual speed the CPU is running at by having the clock output on PC/D/E7 and using a scope to probe it:
```C
PORTCFG.CLKEVOUT = PORTCFG_CLKOUT_PD7_gc;
```
for the time being, I'm just going to use the internal 32MHz oscillator like so:
For the time being, I'm just going to use the internal 32MHz oscillator like so:
```C
OSC.CTRL = OSC_RC32MEN_bm; // enable 32MHz clock
......@@ -49,8 +55,6 @@ CLK.CTRL = CLK_SCLKSEL_RC32M_gc; // switch to 32MHz clock
### [USART](usart/)
<img src="images/usart_registers.png" width="700px">
bare minimum:
```C
......@@ -137,6 +141,29 @@ this will printout once every ~100ms.
### [16-bit Timer/Counter (Pulse Generation)](pulseGen/)
Configuring the timer-counter to generate PWM is relatively straighforward:
```c
// setup pwm
TCC0.PER = 0x0400; //set up 1024 resolution
TCC0.CTRLB |= TC_WGMODE_SS_gc; //single slope
TCC0.CTRLB |= TC0_CCBEN_bm; //enable compare channel on OC0B
TCC0.CTRLA |= TC_CLKSEL_DIV2_gc; //set clock divider to /2 (16 KHz)
set_pwm(512) // 50% duty
```
and I just copied [Sam's](https://gitlab.cba.mit.edu/pub/hello-world/xmega/tree/master/usart) helpful set_pwm() routine to update the duty cycle:
```C
void set_pwm(uint16_t duty){
TCC0.CCBBUF = duty; //set compare value
do {} while(TCC0.INTFLAGS && TC0_OVFIF_bm == 0 ); //wait
TCC0.INTFLAGS = TC0_OVFIF_bm;
}
```
This waits to perform the update at the start of the pwm period (to ensure there are no glitches arising form changing the capture/compare value mid-period).
### [AWEX (Advanced Waveform Extension)](pulseGen/)
......
......@@ -22,4 +22,6 @@
<img src="../images/portE.png" width="700px">
<img src="../../../../../../../" width="700px">
\ No newline at end of file
<img src="../images/portR.png" width="700px">
<img src="../images/usart_registers.png" width="700px">
\ No newline at end of file
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.17/marked.min.js"></script>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<style>
.center {
display: block;
margin-left: auto;
margin-right: auto;
}
img {.center}
</style>
</head>
<xmp id="content" theme="github" style="display:none;">
</xmp>
<script>
$('#content').load("readme.md", function() {
// $.getScript("../strapdown.js");
var s = document.createElement("script");
s.type = "text/javascript";
s.src = "../strapdown/strapdown.js";
$("head").append(s);
});
</script>
</html>
\ No newline at end of file
## Past Work
Three years ago I built this:
<div align="center">
<a href="http://fab.cba.mit.edu/classes/865.15/people/will.langford/11_final/index.html" target="_blank"><img src="../images/dwedm2_01.jpg" width="750px" class="center"></a>
</div>
It looks nice… all the subsystems are there but it just hasn't been integrated.
The two biggest missing parts are: **the pulse generator**, and **the controls**. I'll go ahead and describe what I got up to and talk through what I'd like to try this semester to get this thing going.
#### Pulse Generator
This is what we're making:
<div align="center"><video controls src="images/edm_startup.mp4" width=480px class="center"></video></div>
When I last tried this, I did manage to see some sparking:
<div align="center">
<img src="../images/sparking.gif" width="311px"> <img src="../images/sparking_result.jpg" width="350px">
</div>
My last circuit looked something like this:
<div align="center"><img src="../images/spice3.png" width="600px" class="center">
</div>
Which became a sort-of kludegy board:
<div align="center"><img src="../images/dwedm08.jpg" width="500px" class="center">
</div>
\ No newline at end of file
## Desktop Wire-EDM
### Past Work:
<img src="images/dwedm2_01.jpg" width="700px">
Three years ago I built this:
The two main thrusts of my renewed work on this project are the power electronics (pulse genenerator), and controls:
<div align="center">
### [Past Work](pastWork/)
<a href="http://fab.cba.mit.edu/classes/865.15/people/will.langford/11_final/index.html" target="_blank"><img src="images/dwedm2_01.jpg" width="750px" class="center"></a>
### Recent Work:
</div>
### [Electronics](electronics/)
It looks nice… all the subsystems are there but it just hasn't been integrated.
### [Firmware](firmware/)
The two biggest missing parts are: **the pulse generator**, and **the controls**. I'll go ahead and describe what I got up to and talk through what I'd like to try this semester to get this thing going.
#### Pulse Generator
This is what we're making:
<div align="center"><video controls src="images/edm_startup.mp4" width=480px class="center"></video></div>
When I last tried this, I did manage to see some sparking:
<div align="center">
<img src="images/sparking.gif" width="311px"> <img src="images/sparking_result.jpg" width="350px">
</div>
My last circuit looked something like this:
<div align="center"><img src="images/spice3.png" width="600px" class="center">
</div>
Which became a sort-of kludegy board:
<div align="center"><img src="images/dwedm08.jpg" width="500px" class="center">
</div>
Since then, I've thought about this every now and then, and think I understand the circuit I need a little better now.
I've had some email correspondance with Jaako Fagerlund (who is one of the few people who has made his own desktop EDM) and he had a really nice explanation of how the waveform should work:
<div align="center">
<img src="images/waveform.jpg">
</div>
> The waveform is quite simplified in that picture, but it explains the basics very well. Looking at the upper graph you see gap voltage versus time. As the voltage is switched on, the voltage in the gap is the same as the generators output. If the gap is small enough, the dielectric breaks down and a spark is ignited. This plasma channel is of course lower resistance, so now current (lower graph) starts to flow. The gap voltage drops to basically what the plasma channels resistance times current is. In the graph this area is the lower voltage after full (open) voltage. Then after the on time pulse length is achieved, the generator switches of, the current flow stops and the gap voltage is zero until the generator once again applies a new pulse.
Based on this, this is the basic circuit schematic that I'm after:
<img src="images/basic_schematic.jpg" width="600px" class="center">
With a few more details filled in:
<img src="images/annotated_schematic.jpg" width="600px" class="center">
My understanding of the waveform:
<img src="images/waveforms.jpg" width="600px" class="center">
#### Controls
### Controls
To control the Wire-EDM, we can't just simply use a standard g-code interpretter and machine controller since the motion of the axes needs to depend on how quickly/slowly the material is being eroded.
......@@ -75,3 +23,5 @@ This will involve things like the [Bresenham line algorithm](https://en.wikipedi
We can tell how much material has eroded and how large the gap between the wire and workpiece is by sampling the voltage across the spark capacitor. In the limit where the gap is large and there's no spark, this voltage will be the same as the voltage determined by the charge control circuitry. At the other limit, where the wire actually touches the workpiece, there is a short circuit and there's no voltage across the capacitor.
What I'm not sure about is exactly how fast I want to be able to step to react to changing gap voltages. Many circuits I've seen elsewhere use op-amps configured as a window comparator to servo the stepper motors based on the gap voltage. I will probably start by trying to implement this in firmware with something like an NRF52. With this microcontroller, I can use things like the PPI system to have events triggered automatically without bogging down the main-code.
###
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment