Your concept sounds intriguing and I found a good site to read up on the subject. However I must say that (2) PCF8575 and (1) MCP32008 is an awfully big footprint for the proto board.
Bruce, I am more just pointing out a concept of I2C handling everything on the eeprom pins. The 8575 is not available in DIP, so the device you are already using is fine if you just need 8 IO in DIP form. If you can manage a breakout board, then:
Let's say you have a number of variables that define your bitfields elsewhere in code, for example
CON
LockAGreen_Pin = %0000_0001
LockARed_Pin = %0000_0010
FreewheelPin = %0001_0000
PUB MAIN
Lock := 0
SetPcbLED_PinState
Freewheel := MtrRun 'enable the motor
SetPcbLED_PinState
PUB SetPcbLED_PinState 'determine pinstate and write it
case Lock 'single locking system
1 : PcbPinState |= LockAGreen_Pin 'bit high means LED = off
PcbPinState |= LockBGreen_Pin
PcbPinState &= !LockARed_Pin 'bit low means LED = ON
PcbPinState &= !LockBRed_Pin 'LOW is LED GND
0 : PcbPinState &= !LockAGreen_Pin
PcbPinState &= !LockBGreen_Pin
PcbPinState |= LockARed_Pin
PcbPinState |= LockBRed_Pin
case Freewheel 'LED state top check 9
mtrrun : PcbPinState |= FreewheelPin 'OR the freewheel pin = pin high
mtroff : PcbPinState &= !FreewheelPin 'AND NOT the freewheel pin = pin LOW
case StoreLED 'LED state top check 15
1 : PcbPinState |= StoreLED_pin
0 : PcbPinState &= !StoreLED_pin
case SetupLED 'LED state top check 16
1 : PcbPinState |= SetupLED_pin 'bit high means LED = off
0 : PcbPinState &= !SetupLED_pin 'bit low means LED = ON
i2c2.i2cStart(i2cSCL1) 'start the transaction
i2c2.i2cWrite(i2cSCL1,%0100_010_0 + 0) 'this is a write = + 0 + 1 is a read
i2c2.i2cWrite(i2cSCL1, PcbPinState ) 'send the 1st byte turn on LED with any 1 PcbPinState
i2c2.i2cStop(i2cSCL1)
This makes toggling an output very easy just tell the var what value it is, then call the i2c method that uses CASE to set the outputs. Very similar for the inputs. This example is for the 8574 which is 8outputs, but the method is the same, just an extra byte to send.
Side note, a lot of people have their own favorite expander, and some expanders have different features. Bill may argue the MCP is better and he could be right as I have never used it or looked at it. However, I have used a few thousand of the 8574/5 and like the simplicity and functionality.
I now see that you added some code and I appreciate that, however it makes me feel ignorant
There is a lot that I want to know, but so little time to acquire the knowledge necessary for my various interests. Most of my programming experience never used bitwise operators, it was always equals, not equals, greater than, less than, etc... Then I get into uCs and I see you guys using the bitwise operators all the time, and I understand why, I just never took the time to learn them. However I must face facts, and if I am going to intelligently participate, I will have to learn a lot more about SPI, IC2, and bitwise operators.
I still consider myself a newbie concerning uCs, electronics, and bitwise operators
However I intend to learn a lot more about the forementioned subjects as time permits. Please be patient.
In reference to Post #88, I believe this illustration would be more accurate pertaining to the use of the MCP23008, however I am still uncertain, just trying to muddle my way through at the moment.
I'm not sure if you abandoned the use of the directly connected 3.3v relay or not but if you didn't, the propeller is unlikely to be able to drive the coil directly.
Also, this thread is awesome as it shows project development through all the stages. Make sure when we start on firmware the source is open.
I'm not sure if you abandoned the use of the directly connected 3.3v relay or not but if you didn't, the propeller is unlikely to be able to drive the coil directly.
Check out Posts 81 & 84 for inforamtion regarding this subject.
In the illustration below, you will notice two red circles marked 1 and 2. These circles represent current problems.
Pertaining to the circle labeled #1, the ADC now has several potential problems associated with the layout, which are as follows:
The datasheet for the MCP3208 states that no traces should be going under the IC. In it's current position, it has three traces from the proto board going underneath it. I am concerned, but at this point, I will take my chances.
There is some discrepancy pertaining to the input voltage of this chip. Some say that it must be supplied with 5VDC to work properly with a VREF of 3.3V, and others say that 3.3V at both locations is fine. I am not an electrical engineer, so I will test it as drawn and make changes if necessary.
The datasheet also recommends a bypass capacitor value of 1 uF. It will be difficult to fit it in the alloted space, but it can be done with some creativity. I may alter the illustration later to include this capacitor, but most likely I will leave it up to the builder to insert it.
As previously mentioned, the yellow wire going across the top of the ADC is actually a wire on the bottom of the board.
Pertaining to the circle labeled #2:
The circuitry for the green wire (IO pin 9) and the blue wire (DISABLE input for the stepper drivers) still needs to be reviewed, determined, and drawn. If I am not mistaken, a simple transistor is inserted at this location, along with ground, and when you want the steppers disabled, simply go high on pin 9 driving the DISABLE input to ground. As I said, I need to review this and it applies to Gecko G251 stepper drives. Your DISABLE pins may require a different type of input and may require slightly different circuitry, but I believe those two wires should do the trick for you.
As it stands now, I am really getting eager to get this board done, just to play with it and all the neat electronics that will be asssociated with it, such as:
Parallax Backlit 4 X 20 Serial LCD
Propeller Memory Card
Resistance wire
12 volt fan
(2) Thermistors
MPC3208 ADC IC
MCP23008 IO Expansion IC
(4) Stepper drivers and motors
Various switches and buttons
In all likelihood, I will build some sort of test setup, just for testing, programming, and tweaking the controller board. I foresee this as a fun project. Even if this plan does not work out, I think it will still be fun trying.
EDIT: LOL Another one of those DUH moments... While I was sitting here pondering my test setup, it dawned on me that I should just mount the electronics in their permanent location, a NEMA 1 J-box. As previously mentioned, I have a 4 X 4 X 24 NEMA 1 J-Box available for this project. Why do the same work twice? Although, I will still need some way to temporarily mount the stepper motors.
Correct, I pushed the wrong button... it can actually save you four, as you don't need /CS,SCK,MOSI,MISO for the SPI version, and the I2C version would share the I2C bus with the EEPROM (essentially zero pins used)
Diagram looks OK except for the missing SCL & SDA for the I2C bus going to the prop pins used (28 & 29, you will have to check which is SDA and SCL, I don't remember right now)
Earlier you said that moving to the MCP23008 would save me one pin. I found a schematic elsewhere on the web, that only utilizes two pins, one for SCL and one for SCA. If this would work, than that would free up two pins for me, as compared to my previous layout with the MCP23S08.
If you would be so kind, could you please take a look at the illustration below and tell me if this would work. I have added two 10K resistors that were not shown in the schematic, because I read elsewhere that it was a good idea. Either way I am clueless.
As it stands now, I am really getting eager to get this board done, just to play with it and all the neat electronics that will be asssociated with it, such as:
Parallax Backlit 4 X 20 Serial LCD
Propeller Memory Card
Resistance wire
12 volt fan
(2) Thermistors
MPC3208 ADC IC
MCP23008 IO Expansion IC
(4) Stepper drivers and motors
Various switches and buttons
In all likelihood, I will build some sort of test setup, just for testing, programming, and tweaking the controller board. I foresee this as a fun project. Even if this plan does not work out, I think it will still be fun trying.
EDIT: LOL Another one of those DUH moments... While I was sitting here pondering my test setup, it dawned on me that I should just mount the electronics in their permanent location, a NEMA 1 J-box. As previously mentioned, I have a 4 X 4 X 24 NEMA 1 J-Box available for this project. Why do the same work twice? Although, I will still need some way to temporarily mount the stepper motors.
May I recommend loading a current Tachyon binary onto the board and using .I2CBUS .... to explore you new creation and test the connections/stuff interactively. I'm not saying code the system in FORTH but for testing first hardware oh what a joy. Warning, it can be a highly productive/addictive environment once you get some basic chops. Also anything the masters on this list suggest (you know the ones) I would follow. Don't worry about the software (I2C), you see all the talent on this list, they will help.
Special thanks to Bill Henning and T Chap for pushing and helping with the I2C issue, with honorable mention for Loopy Byteloose and Kwinn for pointing out additional possilities for the ADC.
Let me state for the record, that I never wanted extra pins, I just wanted to have enough pins. What good are extran pins if you don't need them? Anyhow, while it may not be particularly useful for a 3D printer, I have always considered homing and limit switches of the utmost importance, especially for CNC machines in general. While I believe it is a good idea to have the over-travel and E-stop wired in series to a single pin, this certainly would not be beneficial for homing switches. From the start of this endeavor, I wanted homing switches to have their own IO pins, but then it appeared that I would not have this luxury, so I opted at allocating them to the ADC as suggested by Loopy Byteloose and Kwinn. Towards the end, Bill Henning suggested an IC, but I came to the concluwsion that the footprint was just too darn big for this project, so I sought out another expansion IC for the user interface. After finding one with a footprint small enough to satisfy me, I soon discovered that I was going to be one pin short, unless I was willing to wire the DISABLE to either 28, 29, 30, or 31. At Bill's urging and T Chaps persuasive comments, I opted to go with the I2C version of the exspansion IC, and tied it in to pins 28 and 29, this was the PERFECT solution for all problems, because I suddenly had three IO pins at my disposal. After deliberating for a while, I came to the conclusion to add the homing switches to these three pins.
With NO pins remaining (providing the daughter board is used, 3 remaining otherwise), I present the one Propeller CNC/3D printer solution on a Propeller Proto Board. And here is a summary of the controller:
6 available ADC channels
8 configurable GPIO pins for a user interface
3 over-travel limit switches wired in series with 1 E-stop
3 individually wired homing switches for X, Y, and Z axes
3 pin header for serial LCD
Provisions for four stepper drivers
Header to provide 3 IO pins for a daughter board or these pins can be used for something else.
13 pin header for attachment for a Propeller Memory Card, which provides 4 MB non-volatile flash memory, 128 KB of static RAM, and a card slot for microSD.
I believe this setup will be a good solution for many CNC machines and 3D printers, providing the software will fit, and providing the traces under the ADC do not cause any havoc.
Without further delay, I present to you the rough draft of the final layout. Please note that I have not included any wiring to the channels of the ADC, nor have I finished the wiring for the DISABLE input of the stepper drivers, that will be controlled by IO pin 11, because these items are likely to be different per your requirements.
If you notice any mistakes or can simply suggest some improvements, please don't hesitate to make a post, so that others may benefit from your viewpoint or knowledge.
Bruce
EDIT: I now realize that I spoke a wee bit too soon. As I see it, this layout should be just fine for a 3D printer, but as for a CNC controller, there is still one aspect of this design that I do not like. For a 3D printer, it may be perfectly acceptable to have all the stepper drivers disabled at once by pin 11, but for some CNC machines, this may not be the least bit acceptable. I have come to the conclusion that if I want seperate DISABLE(s), I will have to go with an I2C ADC and rearrange the layout a little. Considering this is a proto board, I need a through hole solution and there is not much available, except the PCF8591 from NXP. This IC comes in a 16 pin DIP package, having 8 bit resolution, three ADC channels and one DAC channel.
Providing the Propeller Memory Card proves to be advantagous in holding a large g-code interpreter, yes, the thought has crossed my mind I am just not yet sure how all this memory can assist me. If it all works out, then I will probably break everything down to a component level and create one board with on board stepper drivers and one without.
Just to give you a heads up. Earlier I wrote there would be 4 over-travel limit switches wired in series with the 1 E-stop, but I only had provisions for 3 limit switches and 1 E-stop, so I corrected that statement. However I will be adding provisions for another limit switch, for CNC machines, since there are provisions for 4 stepper drivers. Additionally as mentioned, for CNC machines, I think each of the 4 stepper drivers should have it's own homing pin, but at this moment, there are only 3.
I thought I was done, but now I don't think so, especially since it is pretty darn close for 4 motor CNC machines.
I'd stay with the MCP3208, the PCF8591 is only an 8 bit ADC.
What I'd do in your shoes is use an MCP23017 instead of the MCP23008 (there is enoug space for it if you run the wires for the four pin motor controllers on the bottom of the board) and
move the 3 travel switches and 3 homing switches to the MCP23017, this would free up six pins for you.
You can scan the switches well over 100 times per second, which is more than fast enough.
Special thanks to Bill Henning and T Chap for pushing and helping with the I2C issue, with honorable mention for Loopy Byteloose and Kwinn for pointing out additional possilities for the ADC.
Let me state for the record, that I never wanted extra pins, I just wanted to have enough pins. What good are extran pins if you don't need them? Anyhow, while it may not be particularly useful for a 3D printer, I have always considered homing and limit switches of the utmost importance, especially for CNC machines in general. While I believe it is a good idea to have the over-travel and E-stop wired in series to a single pin, this certainly would not be beneficial for homing switches. From the start of this endeavor, I wanted homing switches to have their own IO pins, but then it appeared that I would not have this luxury, so I opted at allocating them to the ADC as suggested by Loopy Byteloose and Kwinn. Towards the end, Bill Henning suggested an IC, but I came to the concluwsion that the footprint was just too darn big for this project, so I sought out another expansion IC for the user interface. After finding one with a footprint small enough to satisfy me, I soon discovered that I was going to be one pin short, unless I was willing to wire the DISABLE to either 28, 29, 30, or 31. At Bill's urging and T Chaps persuasive comments, I opted to go with the I2C version of the exspansion IC, and tied it in to pins 28 and 29, this was the PERFECT solution for all problems, because I suddenly had three IO pins at my disposal. After deliberating for a while, I came to the conclusion to add the homing switches to these three pins.
With NO pins remaining (providing the daughter board is used, 3 remaining otherwise), I present the one Propeller CNC/3D printer solution on a Propeller Proto Board. And here is a summary of the controller:
6 available ADC channels
8 configurable GPIO pins for a user interface
3 over-travel limit switches wired in series with 1 E-stop
3 individually wired homing switches for X, Y, and Z axes
3 pin header for serial LCD
Provisions for four stepper drivers
Header to provide 3 IO pins for a daughter board or these pins can be used for something else.
13 pin header for attachment for a Propeller Memory Card, which provides 4 MB non-volatile flash memory, 128 KB of static RAM, and a card slot for microSD.
I believe this setup will be a good solution for many CNC machines and 3D printers, providing the software will fit, and providing the traces under the ADC do not cause any havoc.
Without further delay, I present to you the rough draft of the final layout. Please note that I have not included any wiring to the channels of the ADC, nor have I finished the wiring for the DISABLE input of the stepper drivers, that will be controlled by IO pin 11, because these items are likely to be different per your requirements.
If you notice any mistakes or can simply suggest some improvements, please don't hesitate to make a post, so that others may benefit from your viewpoint or knowledge.
Bruce
EDIT: I now realize that I spoke a wee bit too soon. As I see it, this layout should be just fine for a 3D printer, but as for a CNC controller, there is still one aspect of this design that I do not like. For a 3D printer, it may be perfectly acceptable to have all the stepper drivers disabled at once by pin 11, but for some CNC machines, this may not be the least bit acceptable. I have come to the conclusion that if I want seperate DISABLE(s), I will have to go with an I2C ADC and rearrange the layout a little. Considering this is a proto board, I need a through hole solution and there is not much available, except the PCF8591 from NXP. This IC comes in a 16 pin DIP package, having 8 bit resolution, three ADC channels and one DAC channel.
You can scan the switches well over 100 times per second, which is more than fast enough.
Please bear with me....
Now I could be wrong, but I believe my math is in the ballpark.....
Several years ago, I wrote a stepper driver called "PulseTheStepPin". Since I wrote that piece of code, I have worked on the drivers several times and they are much faster now. Anyhow here is an excerpt from that code:
The example section of following code will complete it's execution in 37.48 seconds
1,000,000 Step input pulses / 2000 MicroSteps Per Revolution = 500 Revolutions
500 Revolutions / 37.48 Elapsed Time = 13.34 Revolutions per second
Utilizing a 1/4-20 leadscrew and scanning the switches at 100 times per second, that would allow geater than 3/8" of linear travel between reads, providing my math is correct. As mentioned, my drivers are much faster now, at around 20 revs per second, so the distance traveled would be greater. Scanning switches of a user interface at 100 times per second is more than acceptable, however for limit and homing switches of CNC machines, I think the requirements would be much different.
EDIT: And if a timing belt was utilized instead of a leadscrew, oh baby, watch out!
Well, I believe reacting to reaching a limit switch in 1/100th of a sec should be more than fast enough, but:
1) The MCP230017 has an "Interrupt" output, that can be set when any ping goes high or low. Feed that to a prop pin, and if the prop detects that interrupt pin (which it could in <1us in a tight loop) you could stop all motor action until you determine which limit switch triggered the interrupt
2) The MCP230017 can be run at >1mbps I2c. Assume that a read input registers takes 40 bit periods (approx. correct) that would mean you could read the inputs around 25,000 each second. More than fast enough
Now I could be wrong, but I believe my math is in the ballpark.....
Several years ago, I wrote a stepper driver called "PulseTheStepPin", since I wrote that piece of code, I have worked on the drivers several times since and they are quite a bit faster now. Anyhow here is an excerpt from that code:
The example section of following code will complete it's execution in 37.48 seconds
1,000,000 Step input pulses / 2000 MicroSteps Per Revolution = 500 Revolutions
500 Revolutions / 37.48 Elapsed Time = 13.34 Revolutions per second
Utilizing a 1/4-20 leadscrew and scanning the switches at 100 times per second, that would allow geater than 3/8" of linear travel between reads, providing my math is correct. As mentioned, my drivers are much faster now, at around 20 revs per second, so the distance traveled would be greater. Scanning switches for user input at 100 times per second is more than acceptable, however for CNC machines, I think it would be much different.
The over-travel limit switches and E-stop are currently governed by pin 27, which should be able to monitor those switches rapidly, which is what I truly want.
The homing switches can be checked much slower for homing operations, but they should be able to be read fast, during machine operation, for programming errors, which might cause over-travel in the homing direction.
That being said, with both of you knowing quite well that I can be stubborn..... Do I really need 12 bit ADC resolution for a 3D printer or CNC machine, or will 8 bit be adequate?
Once again I got confused.... The main dilemma is seperate DISABLE inputs for the stepper drivers.
I am attempting to look at this project from all aspects.... One of the main aspects will be the programming of the controller.
As I see it, homing and limit switches can and should be monitored by the main part of the software, whereas the DISABLE inputs for the stepper drivers, should be monitored by the stepper software. So essentially for this board, there would be four seperate stepper objects, with each object requiring a STEP pin definition, a DIRECTION pin definition, and a DISABLE pin definition. Each instance of the object would basically have three functions, which are as follows:
For a 3D printer, the ADC monitors a thermistor for the hot end and the heated building platform. As for a CNC machine, it would all depend upon the equipment. I have my own definition of CNC, being Computer Numerically Controlled. I don't care if it is a lathe, a mill, or an automated shoebox. If it is controlled by numbers that equates to either linear or rotational controlled movement, I personally consider it a CNC machine. Of course others would disagree.
But lets say for instance that you have a three axis machine, where X and Y position a pot of water over a burner for a period of time, then move the pot to a predetermined location, where Z extends downward with a thermocouple to take a reading. If the temperture is appropriate, Z retracts and then X and Y move the pot to another location for further processing. It all depends on the equipment.
Bruce you could have already built a machine in the time you have talked about these limit switches.
LOL Probably.....
Whatever your hand finds to do, do it with all your might
I have wanted a Propeller driven controller for a long time, for many projects. Now that I have decided to put my hands and mind into it, I want the outcome to be the best that I can acheive.
Cool Thread Bruce,
'
Why the need for all the limit switches?
'
(Contact bounce, Won't repeat, Mechanical lag.)
'
I don't use them for homing. Just extreme crash...
Just asking?
'
Wouldn't Encoder feed back be better?
For the sake of discussion, the illustration below represents how I think the controller should be wired, with the exception that the ADC currently shares input pins with the DISABLE inputs for the stepper drivers.
By moving the ADC to I2C, all aspects are covered, except 1 homing switch for a fourth axis, which I can live without.
EDIT: Perhaps this is where the breakout board comes into play. A 12 bit I2C ADC on a breakout board.
EDIT: Enter the Adafruit ADS1015 12-Bit I2C ADC - 4 Channel with Programmable Gain Amplifier $9.95 (http://www.adafruit.com/product/1083)
Provisions for three normally open homing switches or sensors with individual inputs
Provisions for four normally closed overtravel limit switches, wired in series with a E-Stop to an individual input
Provisions for a daughter board mounted to the VGA area. Three inputs and a ground included. These three inputs could be used to control a 12 volt supply necessary for 3D printing operations
DISCLAIMER: This CNC/3D Printer controller has not yet been tested. By purchasing parts and assembling this controller, you do so at your own risk.
EDIT: The DISABLE inputs for all four stepper drivers have been directly wired to IO pins of the Propeller. There will be some instances where a transistor will need to be inserted to switch ground to the DISABLE inputs of the stepper drivers.
Comments
Your concept sounds intriguing and I found a good site to read up on the subject. However I must say that (2) PCF8575 and (1) MCP32008 is an awfully big footprint for the proto board.
https://www.sparkfun.com/products/8130
Let's say you have a number of variables that define your bitfields elsewhere in code, for example
This makes toggling an output very easy just tell the var what value it is, then call the i2c method that uses CASE to set the outputs. Very similar for the inputs. This example is for the 8574 which is 8outputs, but the method is the same, just an extra byte to send.
Side note, a lot of people have their own favorite expander, and some expanders have different features. Bill may argue the MCP is better and he could be right as I have never used it or looked at it. However, I have used a few thousand of the 8574/5 and like the simplicity and functionality.
I claim datasheet deception
I now see that you added some code and I appreciate that, however it makes me feel ignorant
There is a lot that I want to know, but so little time to acquire the knowledge necessary for my various interests. Most of my programming experience never used bitwise operators, it was always equals, not equals, greater than, less than, etc... Then I get into uCs and I see you guys using the bitwise operators all the time, and I understand why, I just never took the time to learn them. However I must face facts, and if I am going to intelligently participate, I will have to learn a lot more about SPI, IC2, and bitwise operators.
I still consider myself a newbie concerning uCs, electronics, and bitwise operators
However I intend to learn a lot more about the forementioned subjects as time permits. Please be patient.
Also, this thread is awesome as it shows project development through all the stages. Make sure when we start on firmware the source is open.
Check out Posts 81 & 84 for inforamtion regarding this subject.
In the illustration below, you will notice two red circles marked 1 and 2. These circles represent current problems.
Pertaining to the circle labeled #1, the ADC now has several potential problems associated with the layout, which are as follows:
- The datasheet for the MCP3208 states that no traces should be going under the IC. In it's current position, it has three traces from the proto board going underneath it. I am concerned, but at this point, I will take my chances.
- There is some discrepancy pertaining to the input voltage of this chip. Some say that it must be supplied with 5VDC to work properly with a VREF of 3.3V, and others say that 3.3V at both locations is fine. I am not an electrical engineer, so I will test it as drawn and make changes if necessary.
- The datasheet also recommends a bypass capacitor value of 1 uF. It will be difficult to fit it in the alloted space, but it can be done with some creativity. I may alter the illustration later to include this capacitor, but most likely I will leave it up to the builder to insert it.
- As previously mentioned, the yellow wire going across the top of the ADC is actually a wire on the bottom of the board.
Pertaining to the circle labeled #2:- 3 pin header hook-up (1 IO pin)
- Piezo speaker
- adjustable backlight
- selectable baud rate
- adjustable contrast
What's not to love? This should be a PERFECT display for my user interface!!! Thank you Parallax for making nice products.I am providing a URL to the image of this LCD, because it does not show up on the product page, at least not in my browser (http://www.parallax.com/sites/default/files/styles/mid-sized-product/public/27979.png). And believe me, this image does not do this product justice. It is big, bright, and shiny
Additionally, I am also providing a URL for the product page, as a courtesy to Parallax (http://www.parallax.com/product/27979).
As it stands now, I am really getting eager to get this board done, just to play with it and all the neat electronics that will be asssociated with it, such as:
- Parallax Backlit 4 X 20 Serial LCD
- Propeller Memory Card
- Resistance wire
- 12 volt fan
- (2) Thermistors
- MPC3208 ADC IC
- MCP23008 IO Expansion IC
- (4) Stepper drivers and motors
- Various switches and buttons
In all likelihood, I will build some sort of test setup, just for testing, programming, and tweaking the controller board. I foresee this as a fun project. Even if this plan does not work out, I think it will still be fun trying.EDIT: LOL Another one of those DUH moments... While I was sitting here pondering my test setup, it dawned on me that I should just mount the electronics in their permanent location, a NEMA 1 J-box. As previously mentioned, I have a 4 X 4 X 24 NEMA 1 J-Box available for this project. Why do the same work twice? Although, I will still need some way to temporarily mount the stepper motors.
Diagram looks OK except for the missing SCL & SDA for the I2C bus going to the prop pins used (28 & 29, you will have to check which is SDA and SCL, I don't remember right now)
May I recommend loading a current Tachyon binary onto the board and using .I2CBUS .... to explore you new creation and test the connections/stuff interactively. I'm not saying code the system in FORTH but for testing first hardware oh what a joy. Warning, it can be a highly productive/addictive environment once you get some basic chops. Also anything the masters on this list suggest (you know the ones) I would follow. Don't worry about the software (I2C), you see all the talent on this list, they will help.
Special thanks to Bill Henning and T Chap for pushing and helping with the I2C issue, with honorable mention for Loopy Byteloose and Kwinn for pointing out additional possilities for the ADC.
Let me state for the record, that I never wanted extra pins, I just wanted to have enough pins. What good are extran pins if you don't need them? Anyhow, while it may not be particularly useful for a 3D printer, I have always considered homing and limit switches of the utmost importance, especially for CNC machines in general. While I believe it is a good idea to have the over-travel and E-stop wired in series to a single pin, this certainly would not be beneficial for homing switches. From the start of this endeavor, I wanted homing switches to have their own IO pins, but then it appeared that I would not have this luxury, so I opted at allocating them to the ADC as suggested by Loopy Byteloose and Kwinn. Towards the end, Bill Henning suggested an IC, but I came to the concluwsion that the footprint was just too darn big for this project, so I sought out another expansion IC for the user interface. After finding one with a footprint small enough to satisfy me, I soon discovered that I was going to be one pin short, unless I was willing to wire the DISABLE to either 28, 29, 30, or 31. At Bill's urging and T Chaps persuasive comments, I opted to go with the I2C version of the exspansion IC, and tied it in to pins 28 and 29, this was the PERFECT solution for all problems, because I suddenly had three IO pins at my disposal. After deliberating for a while, I came to the conclusion to add the homing switches to these three pins.
With NO pins remaining (providing the daughter board is used, 3 remaining otherwise), I present the one Propeller CNC/3D printer solution on a Propeller Proto Board. And here is a summary of the controller:
- 6 available ADC channels
- 8 configurable GPIO pins for a user interface
- 3 over-travel limit switches wired in series with 1 E-stop
- 3 individually wired homing switches for X, Y, and Z axes
- 3 pin header for serial LCD
- Provisions for four stepper drivers
- Header to provide 3 IO pins for a daughter board or these pins can be used for something else.
- 13 pin header for attachment for a Propeller Memory Card, which provides 4 MB non-volatile flash memory, 128 KB of static RAM, and a card slot for microSD.
I believe this setup will be a good solution for many CNC machines and 3D printers, providing the software will fit, and providing the traces under the ADC do not cause any havoc.Without further delay, I present to you the rough draft of the final layout. Please note that I have not included any wiring to the channels of the ADC, nor have I finished the wiring for the DISABLE input of the stepper drivers, that will be controlled by IO pin 11, because these items are likely to be different per your requirements.
If you notice any mistakes or can simply suggest some improvements, please don't hesitate to make a post, so that others may benefit from your viewpoint or knowledge.
Bruce
EDIT: I now realize that I spoke a wee bit too soon. As I see it, this layout should be just fine for a 3D printer, but as for a CNC controller, there is still one aspect of this design that I do not like. For a 3D printer, it may be perfectly acceptable to have all the stepper drivers disabled at once by pin 11, but for some CNC machines, this may not be the least bit acceptable. I have come to the conclusion that if I want seperate DISABLE(s), I will have to go with an I2C ADC and rearrange the layout a little. Considering this is a proto board, I need a through hole solution and there is not much available, except the PCF8591 from NXP. This IC comes in a 16 pin DIP package, having 8 bit resolution, three ADC channels and one DAC channel.
EDIT: Here is a link to the PCF8591 datasheet (http://www.nxp.com/documents/data_sheet/PCF8591.pdf).
Are you thinking of committing to a custom board down the road? I was putting the components into Express PCB to see if they fit.
Jim
Providing the Propeller Memory Card proves to be advantagous in holding a large g-code interpreter, yes, the thought has crossed my mind I am just not yet sure how all this memory can assist me. If it all works out, then I will probably break everything down to a component level and create one board with on board stepper drivers and one without.
Bruce
Just to give you a heads up. Earlier I wrote there would be 4 over-travel limit switches wired in series with the 1 E-stop, but I only had provisions for 3 limit switches and 1 E-stop, so I corrected that statement. However I will be adding provisions for another limit switch, for CNC machines, since there are provisions for 4 stepper drivers. Additionally as mentioned, for CNC machines, I think each of the 4 stepper drivers should have it's own homing pin, but at this moment, there are only 3.
I thought I was done, but now I don't think so, especially since it is pretty darn close for 4 motor CNC machines.
I'd stay with the MCP3208, the PCF8591 is only an 8 bit ADC.
What I'd do in your shoes is use an MCP23017 instead of the MCP23008 (there is enoug space for it if you run the wires for the four pin motor controllers on the bottom of the board) and
move the 3 travel switches and 3 homing switches to the MCP23017, this would free up six pins for you.
You can scan the switches well over 100 times per second, which is more than fast enough.
Please bear with me....
Now I could be wrong, but I believe my math is in the ballpark.....
Several years ago, I wrote a stepper driver called "PulseTheStepPin". Since I wrote that piece of code, I have worked on the drivers several times and they are much faster now. Anyhow here is an excerpt from that code:
Utilizing a 1/4-20 leadscrew and scanning the switches at 100 times per second, that would allow geater than 3/8" of linear travel between reads, providing my math is correct. As mentioned, my drivers are much faster now, at around 20 revs per second, so the distance traveled would be greater. Scanning switches of a user interface at 100 times per second is more than acceptable, however for limit and homing switches of CNC machines, I think the requirements would be much different.
EDIT: And if a timing belt was utilized instead of a leadscrew, oh baby, watch out!
1) The MCP230017 has an "Interrupt" output, that can be set when any ping goes high or low. Feed that to a prop pin, and if the prop detects that interrupt pin (which it could in <1us in a tight loop) you could stop all motor action until you determine which limit switch triggered the interrupt
2) The MCP230017 can be run at >1mbps I2c. Assume that a read input registers takes 40 bit periods (approx. correct) that would mean you could read the inputs around 25,000 each second. More than fast enough
Hope this helps.
I stand corrected
Still, depending upon the requirements, 0.01" could be significant.
I don't know if you guys caught my "EDIT:" in the previous post, but the use of timing belts should also be a major concern.
@Bill - I will have to read your response a little more in depth.
I became slightly confused.
The over-travel limit switches and E-stop are currently governed by pin 27, which should be able to monitor those switches rapidly, which is what I truly want.
The homing switches can be checked much slower for homing operations, but they should be able to be read fast, during machine operation, for programming errors, which might cause over-travel in the homing direction.
That being said, with both of you knowing quite well that I can be stubborn..... Do I really need 12 bit ADC resolution for a 3D printer or CNC machine, or will 8 bit be adequate?
I am attempting to look at this project from all aspects.... One of the main aspects will be the programming of the controller.
As I see it, homing and limit switches can and should be monitored by the main part of the software, whereas the DISABLE inputs for the stepper drivers, should be monitored by the stepper software. So essentially for this board, there would be four seperate stepper objects, with each object requiring a STEP pin definition, a DIRECTION pin definition, and a DISABLE pin definition. Each instance of the object would basically have three functions, which are as follows:
For a 3D printer, the ADC monitors a thermistor for the hot end and the heated building platform. As for a CNC machine, it would all depend upon the equipment. I have my own definition of CNC, being Computer Numerically Controlled. I don't care if it is a lathe, a mill, or an automated shoebox. If it is controlled by numbers that equates to either linear or rotational controlled movement, I personally consider it a CNC machine. Of course others would disagree.
But lets say for instance that you have a three axis machine, where X and Y position a pot of water over a burner for a period of time, then move the pot to a predetermined location, where Z extends downward with a thermocouple to take a reading. If the temperture is appropriate, Z retracts and then X and Y move the pot to another location for further processing. It all depends on the equipment.
LOL Probably.....
I have wanted a Propeller driven controller for a long time, for many projects. Now that I have decided to put my hands and mind into it, I want the outcome to be the best that I can acheive.
'
Why the need for all the limit switches?
'
(Contact bounce, Won't repeat, Mechanical lag.)
'
I don't use them for homing. Just extreme crash...
Just asking?
'
Wouldn't Encoder feed back be better?
By moving the ADC to I2C, all aspects are covered, except 1 homing switch for a fourth axis, which I can live without.
EDIT: Perhaps this is where the breakout board comes into play. A 12 bit I2C ADC on a breakout board.
EDIT: Enter the Adafruit ADS1015 12-Bit I2C ADC - 4 Channel with Programmable Gain Amplifier $9.95 (http://www.adafruit.com/product/1083)
For those folks that want them. I am attempting to provide a Propeller solution for a wide variety of machines and people.
The summary of the board is as follows:
- 8 configurable GPIO for a user interface
- Provisions for 4 configurable ADC channels with an Adafruit breakout board $9.95 (http://www.adafruit.com/product/1083)
- Provisions for four stepper drivers
- Provisions for a Propeller Memory Card
- Provisions for a serial LCD display
- Provisions for three normally open homing switches or sensors with individual inputs
- Provisions for four normally closed overtravel limit switches, wired in series with a E-Stop to an individual input
- Provisions for a daughter board mounted to the VGA area. Three inputs and a ground included. These three inputs could be used to control a 12 volt supply necessary for 3D printing operations
Pim Assignments:P1 - Stepper drive 1 DIRECTION
P2 - Stepper drive 1 STEP
P3 - Over-travel switches
P4 - Serial LCD display
P5 - Stepper drive 1 homing switch
P6 - Stepper drive 2 homing switch
P7 - Stepper drive 3 homing switch
P8 thru P15 - Propeller Memory Card
P16 thru P18 - Daughter board outputs
P19 - Stepper drive 2 STEP
P20 - Stepper drive 2 DIRECTION
P21 - Stepper drive 2 DISABLE
P22 - Stepper drive 3 STEP
P23 - Stepper drive 3 DIRECTION
P24 - Stepper drive 3 DISABLE
P25 - Stepper drive 4 DISABLE
P26 - Stepper drive 4 DIRECTION
P27 - Stepper drive 4 STEP
P28 - SCL for I2C devices
P29 - SDA for I2C devices
EDIT: The DISABLE inputs for all four stepper drivers have been directly wired to IO pins of the Propeller. There will be some instances where a transistor will need to be inserted to switch ground to the DISABLE inputs of the stepper drivers.