Not sure if I have any tiny13's left only 85's. Are you thinking of using the internal clock ? I have done some reading up but for a none programing guy like myself it's over dive on the nerd Seems like there are many ways to skin this cat, software and hardware wise
Even the 85 it's OK (the 13 is cheaper) Yes, for this project is enough Yes for a little more code complexity it's possible to directly analyze the pwm signal (removing the RC filter). In this case I think it's the best solution, whith the 85 because it have two separate Timers inside
I'm not sure but correct me if I'm wrong, how I see it since there are many different input voltage ranges I think a voltage divider circuit before the input would be a good idea. It would be a little more work code wise but this way anything above 5vdc could be adjusted then calculated in code to convert to the proper ms output based on the input voltage. In sence three or four diffent codes to work with the supplied input Know your input volts Adjust divider Upload code for said divider setting
It's better to use an optoisolator, the voltage divider is not so useful But i think to make the siplest (and cheaper) circuit it's better to not use the RC fiter I'll start to think a little on the code...
I agree. It does seem a bit pointless to convert a digital signal to analog in hardware only to convert it back to digital again in software. It would be a simple enough task to sample the Mach3 PWM waveform, measuring the width of a duty cycle pulse then scaling the value found into the 1 mS – 2 mS range then outputting this pulse - all done in a continuous loop repeating at a 20 mS interval. Tweakie.
Did you mean by using Timer Capture? This might do the trick... http://www.atmel.com/Images/doc8014.pdf
Hi Bit53b, Thank you for the information and link (a chip that I didn't even know existed). I think the processing power of the ATtiny and similar R.I.S.C. chips will allow an incoming PWM to be measured quite easily without having to resort to a specialist chip. Of course, the proof of the pudding is always in the eating, so it has yet to be proven but I have every confidence. Tweakie.
quick question for you gents... I know the IPM and spindle speed are the main control points, but do you feel this spindle will handle the task of milling steel? Id love to hear your response; thanks in advance.
Ok I must have miss understood something as I thought mach3 put out a 0-10 anolog signal Now that I re-read things it's the G540 that puts out the 0-10 based on mach3s PWM signal that works with the chin VFDs. So yes my idea is pointless
Hi Tweakie, Sorry I was a little hurried this morning and could have made my explanation/link a lot clearer. The document I linked isn’t a new chip exactly, it’s an Atmel application note explaining how to use the input capture module found in some of the Atmel micro controllers. This is a peripheral feature of the chips, and not a separate, specialist chip. It allows you to calculate frequency, duty cycle of an applied signal using edge-triggered interrupts. I was a bit hasty though, I don’t think it appears on the above devices after all!
The ATtiny85 dont have the Input Capture feature ^^ The solution is to use the pin change interrupt + a timer to measure the lengthof the UP signal & DOWN signal to calculate the value of the PWM PWM_value = T_UP / (T_UP + T_DOWN) Concurrently another timer interrupt is used to generate the new PWM signal
Something that may help but I hit a language block after a few links http://digistump.com/board/index.php?topic=689.0
I have all said parts needed to construct the circuit shown mind you it's a 85 not 45 but that really don't matter other then cost
it's the same chip (only the amount of memory change ) and in the cad one symbol is enough to make the design
Hi Guys, Having babbled on about it, I thought I would just have to give it a try - I had a bit of spare time so connected up a test rig yesterday afternoon. I am using a spare pcb (made for another project), the Microchip PIC12f683 and TTL gates for I/O buffering. For the initial tests I have set a Mach3 spindle range of 0 to 100 to indicate percentage of motor speed so 0% is off and 100% is full speed (GCodes: S0 to S100). I don’t have a spare outrunner (without stripping down one of my models and that is not going to happen) but I am assuming that if we can control a servo then we can control a bldc controller in a similar manner. For those that are interested, here is a short video; http://www.graytel.talktalk.net/bldcPWM.wmv Tweakie.
Wow Well done Tweakie! Was that using the circuit a few posts above? I think I understand the principals about reading and then translating the PWM from Mach3 but I am also well out of my depth on how to code this. Am I correct in assuming I need to build a small programming rig to program the required small IC ?
Hi Jestah, Thanks. I used a different circuit to that posted above but it is not dissimilar. I think that learning to program these R.I.S.C. chips can be regarded as 'where there is a will...' certainly with the 12f683 there are only 35 instructions that can be used and it does not take too long to get familiar with their use - in some ways it is just a great adventure. Yes, a programmer and associated drive software is necessary if you were planning on using the Microchip PIC devices but they are cheaply obtained on the bay (probably all made in China). Tweakie.
Tweakie that's great! (I really like the PIC devices, and especially the development/debugging tools from Microchip)
Thanks Bit53b. (I was fortunate enough to get all the associated Microchip software paid for, a few years back, when working on a ‘smart card’ access system so, for me at least, programming PIC chips is now relatively painless ). Tweakie.
Fortunately someone have already made some code to generate the PWM on the ATtiny85 for the arduino http://www.cunningturtle.com/attiny4585-servo-library/
Hi Robert, How will you vary the speed of the Stinger spindle without Mach3/PWM ? Does GRBL support this? (or did you mean spindle off/on?)