Welcome! Log In Create A New Profile

Advanced

EMC2/Linuxcnc running on Raspberry Pi

Posted by mung 
EMC2/Linuxcnc running on Raspberry Pi
May 10, 2013 06:54AM
I just thought I would post this, as it needs some testers.

Linuxcnc running on the raspberry pi maybe is getting very close to a usable high speed motion controller.

There are 22 IO pins available for running step/dir motor drivers, real time kernel and almost all of the linuxcnc components running correctly.

If you can test this and give feedback to the linuxcnc.org forum it will help speed up the development.

It does not need any extra hardware just plug your stepper drivers into the relevant gpio header pins (thought really I would like people with scopes to send in signal plots and test functions, so plugging motors is not recomended).

Web page for SD card image download is: http://soundproofingforum.co.uk/rpi_linuxcnc/raspberrypilinuxcnc.htm

or you can check the forum thread [linuxcnc.org]
Re: EMC2/Linuxcnc running on Raspberry Pi
May 10, 2013 09:15AM
I can't seem to find any electrical specifications on the Raspberry Pi's IO.

I'm looking for

Input impedance?
analog reading functions? (Voltage, Resistance, Current)
analong ADC bit-resolution?
Sourcing or Sinking?
Internal pull-ups or downs?

Max output current per pin?
Max output current of all pins combined?
Sourcing or Sinking?
PWM?
current controlled?

etc, etc.

With this general information, we can figure out if you can use a Rasberry Pi as a replacement for an Arduino.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 10, 2013 09:41AM
[elinux.org]

[www.scribd.com]

I think 20mA max current.

The drivers are for output only driving step/direction for most stepper motor drivers, eventually some input maybe implemented.

It can drive bog standard chinese tb6560 stepper drivers, but as said no thorough tests have been made as I do not have suitable test equipment.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 10, 2013 10:57AM
I don't have a scope but I've got everything else. I'll give it a go this weekend.


- akhlut

Just remember - Iterate, Iterate, Iterate!

[myhomelessmind.blogspot.com]
Re: EMC2/Linuxcnc running on Raspberry Pi
May 10, 2013 11:28AM
mung Wrote:
-------------------------------------------------------
> [elinux.org]
>
> [www.scribd.com]
> rol2
>
> I think 20mA max current.
>
> The drivers are for output only driving
> step/direction for most stepper motor drivers,
> eventually some input maybe implemented.
>
> It can drive bog standard chinese tb6560 stepper
> drivers, but as said no thorough tests have been
> made as I do not have suitable test equipment.

Thanks for the info..

GPIO voltage levels are 3.3 V and are not 5 V tolerant. There is no over-voltage protection on the board

NOPE, you won't be able to use a Pi's GPIO without a ton of extra external electronics.

That's a serious disappointment that the Pi can't even handle 5V logic.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 10, 2013 02:14PM
ShadowRam Wrote:
> GPIO voltage levels are 3.3 V and are not 5 V
> tolerant. There is no over-voltage protection on
> the board
>
> NOPE, you won't be able to use a Pi's GPIO without
> a ton of extra external electronics.
>
> That's a serious disappointment that the Pi can't
> even handle 5V logic.

Have you ever tried using resistors?

I don't want to start telling you what to do as I know you are an independent and intelligent minded person, I can see where you are coming from and know that the arduino is a vastly superior system for use in 3D printing. But it is good for people to have choice and there are many different considerations that different people may have in making a choice, the idea of the rpi as a controller is to give people a choice to use a cheaper microcontroller system that does the job adequately rather than using an expensive and over powered system that is more than they really need for the job. I know over voltage protection is very important and arduino voltage protection is vastly superior, but someone maybe able to implement something to do the job such as these voltage protectors, but unless people like you shadowram want to get involved and help out we are not going to move forward in reducing the cost of these components. There is always a BIG FAT WARNING regarding experimental and bleeding edge systems, and maybe I should have made it clearer that this is a total botch job and you should use at your own risk. It is only meant for testing by experienced users.

I know nothing about electronics so I just assumed that the raspberry pi would just work as it is electronical and had some pins on it that looked like arduino pins.

I was told that the system is for output only, that means you do not need 5volt tolerant input pins as the pins are only used as outputs, but I did not realise that the reprap had to have 5volt inputs to drive the stepper motor drivers, I should have done some more research before posting this. I may try and look at ways to input high voltage signals into the raspberry pi and will continue with my research, do you know how much voltage they must handle? someone told me that some stepper motors need 50volts, how can i handle this much voltage in such a small computer can i store it in something??

Anyways if you can help any further in how to get this working all help will be graciously received, or if you can help in how to get a cheaper arduino board that would be another option.

I know sometimes its fun playing avocardo or beet or many of the other interesting vegetables and sometimes even fruit. And it is good that you are putting some effort into thinking laterally, in the words of cecil rhodes 'May you come to the attention of those in authority'
Re: EMC2/Linuxcnc running on Raspberry Pi
May 10, 2013 02:14PM
Got a raspberry pi, a scope, and a stepper motor driver, so I'm willing to test when I have time.

As far as the voltage issues go there's this:
[github.com]
Re: EMC2/Linuxcnc running on Raspberry Pi
May 10, 2013 02:31PM
ShadowRam Wrote:
>
> GPIO voltage levels are 3.3 V and are not 5 V
> tolerant. There is no over-voltage protection on
> the board
>
> NOPE, you won't be able to use a Pi's GPIO without
> a ton of extra external electronics.
>
> That's a serious disappointment that the Pi can't
> even handle 5V logic.

It's worth noting the caveat about 3.3V. The same goes for the Arduino Due, it's pins are not 5V tolerant. It's not true a "ton of extra electronics" is required, but certainly some adaptation is needed.

You can drive a Pololu stepper with 3.3V for STEP and DIR, even if the Pololu is running at 5V. However, some of the logic pins on the Pololu may be pulled to VCC, so it would be better to run the Pololu on 3.3V. The motor voltage should not matter.

There are other issues to do with using 3.3V, e.g. endstops typically run at 5V, MOSFETs will not be driven properly at 3.3V. Add-ons using SPI, I2C etc will need reviewing for compatibility.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 10, 2013 02:50PM
A good source of info on the Pi's GPIO is [elinux.org]

mung as to "Have you ever tried using resistors?"
Your not going to drive 5 volt logic from 3.3v signals with just resistors. You need to learn some basic electronics.

Although is also has the same challenge of 3.3v logic, I would have thought a BeagleBone Black ( BBB )
would be a better solution than the raspberry pi as it has more GPIO supports ADC see [beagleboard.org]
its more powerful and only $10 more, but when you factor in SD cards, cables etc its probably cheaper.

Edited 1 time(s). Last edit at 05/10/2013 03:33PM by KeithSloan.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 10, 2013 03:28PM
I spent some time looking at various ARM solutions, both microcontrollers and microprocessors.
I think linux is the wrong platform for a motor controller, but if you did go that way I don't understand the obsession with the RPi, there are similarly priced boards that are better suited and if it came to it doing a small production run of a 100 or so boards isn't prohibitively expensive. BeagleBoards have been mentioned and don't have the licensing restrictions of many commercial dev boards, the cubie board would also work.
The 3.3 vs 5V thing seems irrelevant to me, unless there is some desperate desire to repurpose the existing arduino shields which I just don't think there is a need for.

Having said all of that It's nice to see EMC2 running on RPi though, I'm interested in how fast a pulse train you reliably put out across say 4 axis?


___________________________________________________________________________

My blog [3dprinterhell.blogspot.com]
Re: EMC2/Linuxcnc running on Raspberry Pi
May 10, 2013 03:50PM
KeithSloan Wrote:
-------------------------------------------------------
> A good source of info on the Pi's GPIO is
> [elinux.org]
>
> mung as to "Have you ever tried using resistors?"
> Your not going to drive 5 volt logic from 3.3v
> signals with just resistors. You need to learn
> some basic electronics.

Actually, you can often drive 5V logic from 3.3V if the threshold level is compatible. No resistors required.

Could we have less of the snarkiness all round please? There's no need for it, this is purely a technical matter.

> Although is also has the same challenge of 3.3v
> logic, I would have thought a BeagleBone Black (
> BBB )
> would be a better solution than the raspberry pi
> as it has more GPIO supports ADC see
> [beagleboard.org]
> its more powerful and only $10 more, but when you
> factor in SD cards, cables etc its probably
> cheaper.

The Beagle Black looks very nice, if you can get hold of one. I have one on order...

There is also a cape for 3D printer control called Replicape, which will also be on sale sometime.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 11, 2013 07:02AM
bobc Wrote:

>
> Actually, you can often drive 5V logic from 3.3V
> if the threshold level is compatible. No resistors
> required.
>
Very Bad Engineering, might be okay as hackery,

Original comment was about adding resistors to drive 5V logic with 3.3V.
Adding resistors without any active components can only reduce 3.3V not boost towards 5V
and deserves all the snarkiness comments it gets.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 11, 2013 09:01AM
KeithSloan Wrote:
-------------------------------------------------------
> bobc Wrote:
>
> >
> > Actually, you can often drive 5V logic from
> 3.3V
> > if the threshold level is compatible. No
> resistors
> > required.
> >
> Very Bad Engineering, might be okay as hackery,
>
> Original comment was about adding resistors to
> drive 5V logic with 3.3V.
> Adding resistors without any active components can
> only reduce 3.3V not boost towards 5V
> and deserves all the snarkiness comments it gets.

Sorry, but now you are just talking bollocks. You clearly know fuck all about electronics, and that deserves all the rude comments it gets.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 11, 2013 09:31AM
I have reservations about anything with the word 'hipster' in it these days.

[hipstercircuits.com]

[bitbucket.org]

replicape videos

[vimeo.com]

The issue I've got with this "cape" is that it will be fairly difficult to solder up for the average person as it has smd components on both sides.


- akhlut

Just remember - Iterate, Iterate, Iterate!

[myhomelessmind.blogspot.com]
Re: EMC2/Linuxcnc running on Raspberry Pi
May 11, 2013 12:41PM
Quote

You can drive a Pololu stepper with 3.3V for STEP and DIR, even if the Pololu is running at 5V.

The logic '1' threshold is 0.7 * VDD which is 3.5V. so no you can't drive it with 3.3V logic and meet the spec.

Yes you can drive 5V TTL from 3.3V CMOS but in general 5V CMOS has higher logic thresholds.

Resistors are only useful for going from 5V logic to 3.3V, how can they help the other way unless you have open drain logic?

Edited 1 time(s). Last edit at 05/11/2013 12:43PM by nophead.


[www.hydraraptor.blogspot.com]
Re: EMC2/Linuxcnc running on Raspberry Pi
May 11, 2013 03:08PM
nophead Wrote:
-------------------------------------------------------
> You can drive a Pololu stepper with 3.3V for STEP
> and DIR, even if the Pololu is running at 5V.
>
> The logic '1' threshold is 0.7 * VDD which is
> 3.5V. so no you can't drive it with 3.3V logic and
> meet the spec.
>
> Yes you can drive 5V TTL from 3.3V CMOS but in
> general 5V CMOS has higher logic thresholds.
>
> Resistors are only useful for going from 5V logic
> to 3.3V, how can they help the other way unless
> you have open drain logic?

I am not sure who said what anymore, and I am not sure what some of the jargon means, if anyone can define what 'tolerant', 'input', and 'ttl' and 'snarkiness' means maybe I could workout what I am talking about?

But as far as far as 4000 series CMOS is concerned I am sure arduino is vastly superior in compatability and also rpi will have problems with ECL logic and some of the higher speed galium arsenide logic systems also non silicon based switches almost definitly will not work on the rpi. I think the rpi is probably a dead end if higher speed logic is required for printing big things and storing all the voltage for 50volt motors in the chip will be much harder without a big bit bucket, I wonder how fast the motors need to go?. Arduino holds much more power and can generate a better reprap as it is more used.

I really don't know anything about electronical machines I am more of an organic developer and all I did was ask on the arduino forums what would be needed, but they were very helpful and explained how the arduino would cope this. The arduino people told me that rpi is not really compatible with logic and that arduino would work with most things in a better way and be much easier. I think maybe the arduino was made for a better reason and I doubt I understand how reprap needs logic well enough so it is better to use the arduino.

All I know is that apparently rpi sometimes works with tb6560 drivers [www.toshiba.com], I don't know what a polulu is, where can I get a polulu from and will it drive a reprap fast enough?

Please keep the comments coming all this is helping me learn this stuff and its very interesting all the myriad things that need to be known to make a reprap print things.

Edited 1 time(s). Last edit at 05/11/2013 03:34PM by mung.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 12, 2013 08:30AM
The Beaglebone Black really is a compelling little platform!

£30, Beastly Arm Cortex A8, 512MB Ram, has ethernet/hdmi/usb etc.

But 3.3v - argh. It's not something that is a complete blocker.


[3.3v MOSFETS exist and are fine for running the high current loads (Bed/Hotend)
Pololu stepper driver is fine on 3.3v according to manufacturer. (Mung - this is the most popular stepper driver used for RepRaps etc)
The only issue is the inputs, ADC is pretty poor - but replace with an i2c thermocouple amplifier and you'd be good to go and with better performance all round.

I don't really know whether running linux is a good idea or not. Some people are driving repraps quite happily of desktops with linuxcnc etc. Whether the (quite powerful) ARM core can do the same I have no idea.

The only problem really is software as far as I can see.

It would be lovely to have a networked printer, running something like BotQueue or Octoprint without all this RasPi > RAMPS kerfuffle.

I dream of a ARM single board solution, networked and with ability to accept a cheap touchscreen TFT. Either send job over a web interface. Or walk up to the machine with a USB Key. The board would run something like repetier host where you can place objects on the bed in 3D, hit go, walk away, it slices and starts printing automagically.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 12, 2013 09:26AM
Hm, I am rather inexperienced in this ARM stuff, but AFAIK, there is someone trying to port LinuxCNC to the OLinuXino A13. This board has got a more modern processor than the Raspberry Pi and an UEXT connector that is compatible to a lot of Olimex extensions like temperature sensor boards etc. The whole design including the hardware is open source and they chose components that are easier to hand-solder than e.g. the ones on the RPi.
The OLinuXino is more expensive than the other systems, though.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 15, 2013 10:52AM
uGen Wrote:
-------------------------------------------------------
> Hm, I am rather inexperienced in this ARM stuff,
> but AFAIK, there is someone trying to port
> LinuxCNC to the OLinuXino A13. This board has got
> a more modern processor than the Raspberry Pi and
> an UEXT connector that is compatible to a lot of
> Olimex extensions like temperature sensor boards
> etc. The whole design including the hardware is
> open source and they chose components that are
> easier to hand-solder than e.g. the ones on the
> RPi.
> The OLinuXino is more expensive than the other
> systems, though.

There are many ARM based cnc systems available maybe you should try research in some of the archimedes systems available like [www.techsoft.co.nz]

OLinuXino maybe more expensive but reprap is not about cost it is more important to consider self replication as the first consideration, everything else should be disregarded!

Going with an older system with less high tech fabrication requirements would far outweigh the cost implications because when something is able to self replicate everything becomes free!

Printing of early ARM chips is probably quite simple, has anyone done any research on this?

Once reprap can fabricate energy efficiently well there will become absolute abundance so it is better to think about self replication rather than cost!
Re: EMC2/Linuxcnc running on Raspberry Pi
May 15, 2013 03:40PM
Wait a minute, by Archimedes do you perhaps mean the Acorn Archimedes from the late 80's? It has about a quarter of the processing power of ATmega based Arduinos that are already brought to their limits with the RepRap firmware.
Most of the results I found were not very helpful, but one thing piqued my interest: miniEMC2
There is a weaker, cheaper version of the OLinuXino around (I have one of these) with nearly identical specs. Maybe I should finally get started with exploring this thing more.

I wouldn't say that everything other than self-replication should be disregarded. Low cost means more potential users, leading to more potential developers. If your machine was made of unobtainium in order to self-replicate, it would maybe theoretically be able to do so, but at such a prohibitive cost that practically, it is impossible.

This thread here might be of interest for you if you have not seen it yet: They are posting relay computers (on the second page)! Clicky awesomeness!
Re: EMC2/Linuxcnc running on Raspberry Pi
May 15, 2013 04:00PM
uGen Wrote:
-------------------------------------------------------
> Wait a minute, by Archimedes do you perhaps mean
> the Acorn Archimedes from the late 80's?

Yes the whole point is that it is simpler computer, printing a complex microputer would be almost impossible!

The whole point is to simplify and iterate iterateing is when it will improve!

> I wouldn't say that everything other than
> self-replication should be disregarded. Low cost
> means more potential users, leading to more
> potential developers. If your machine was made of
> unobtainium in order to self-replicate, it would
> maybe theoretically be able to do so, but at such
> a prohibitive cost that practically, it is
> impossible.

You are totally ignoring the whole point of reprap project goals!

If reprap can print more energy then why do you think it cannot print unobtainium???

You do not seem to understand the problems here, it is better to make things simpler then we can have more developers, and once there are more developers they can iterate more faster!

Simple computering makes more iteration quicker, price is irellevant once there is one it will print its self!

There are even more simple computer pcs chipping like 6505 and many are cnc since long ago so it is definite possible and would be quicker for iterate. See this for making cnc in old times [www.cncdoctor.co.uk] if we can only iterate this then we will have a base to start from and can printer everything and iterate more. It is simple makes better, using more complex chip like arduino is never work for printing chips!
Re: EMC2/Linuxcnc running on Raspberry Pi
May 17, 2013 07:34PM
@mung, I can't seem to get your distro to run. I try to login with the default password, but it keeps telling me it's incorrect.

Also, what information do you want from the oscilloscope?
Re: EMC2/Linuxcnc running on Raspberry Pi
May 18, 2013 12:26PM
Given that the ARM2 in the Archimedes is 32 bit while the ATMega is only 8 bit, the lower processing power might not be such a big problem. Yeah, maybe you are right about this one.

Quote
mung
You are totally ignoring the whole point of reprap project goals!

How so? The goal was a self-replicating machine that anyone can have access to (i.e. that is affordable).

Quote
mung
If reprap can print more energy then why do you think it cannot print unobtainium???

I don't know what you mean by "print more energy" - but if you imply that RepRaps could be used to create machines that convert mechanical / chemical energy into electrical (like windmills for example), that would actually be pretty cool.

Quote
mung
You do not seem to understand the problems here, it is better to make things simpler then we can have more developers, and once there are more developers they can iterate more faster!

Simple computering makes more iteration quicker, price is irellevant once there is one it will print its self!

Manufacturing cost might become irrelevant, but you forgot that there is still the feedstock (printing material). No matter how simple the machine is, if the material is astronomically expensive, most of us will not be able to afford that. Thus, the amount of active developers drop.
You have to keep in mind that a lot of RepRap operators are young students that don't earn a lot of money yet and just cannot afford an expensive machine. That is why we cannot sacrifice everything else for the sake of self-replication alone.
But there is nothing speaking against using a component that is slightly more expensive than another one if it offers a distinct advantage, to come back to Raspberry Pi and OLinuXino. The price difference is about 10-20€ though, so using a probably more versatile and easier to replicate OLinuXino instead of the Raspberry Pi won't break the bank.
Hi guys, I don't mean to hi-jack your thread, but I would just give my two cents and encourage
going further with a "cape" for Raspberry Pi. Frankly, I'm surprised no one has done it before.

3.3V is really not a problem, the A4988 (and the DRV8825 used in Replicape) is compatible with both 3.3V and 5V logic.
With the 15+ GPIO pins on the RPi you should be able to control 4 steppers. PWM for MOSFETs can be extended via the I2C pins on the RPi and there are several ADCs that interface via SPI or I2C. It's 700MHz for $25, someone is going to do it eventually : )

The reason I chose to use BeagleBone (the black was not announced when the project started) as a platform for 3D printer electronics was the good support for extending with daughter boards (capes). Other that that I would say that the BeagleBone is more suited for embedded applications with the 96(?) pins available and the good cape support in the kernel. In addition, the two Programmable Real-time Units (PRUs) handle the stepper timings so the 1GHz should be plenty for slicing in real-time, for high level path planning and for showing some nice graphics (een 3D) on an LCD touch display. Still, it is probably not going to be the cheapest combo (The BOM of Replicape is $92 + PCcool smiley due to the use of some quite high quality connectors and stepper drivers.

Using though hole components makes it easier for noobs to solder, but it really adds to the size of the board and the cost when producing in volume. It's not really a problem to solder two sides of a PCB in a re-flow oven. The components will stick when you flip it over.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 20, 2013 08:38AM
@Elias Bakken: The BeagleBone sounds interesting. Did not know about the PRUs before. So if I understand things correctly, you can basically have a standard Linux distro running and still do real-time tasks? In case this is true, that would be one tremendous advance towards an integrated host/controller solution IMHO. EMC2 might not be the ideal solution for everyone after all...
@uGen: Yes, the PRUs will handle the STEP and DIR pins for the 5 stepper motors, but you still have to "make" the data in the sense that you have to pre-compute the timings in a table, but once that is done, you just push the tables to one of the 200MHz PRUs. Using Python it becomes almost trivial. Have look at [hipstercircuits.com] for more info.
Re: EMC2/Linuxcnc running on Raspberry Pi
May 20, 2013 10:46AM
@Elias Bakken: I see. Thanks for the link!
So it is more or less like we are doing it now with the Arduinos: buffering the instructions that are being sent to the µC <> sending step tables to the PRU
Can't wait to see something like a SCARA implemented more elegantly on a BeagleBone (or doing this myself).
@uGen: A SCARA implementation should definitely be doable. I implemented an H-type belt system in a matter of hours: http://hipstercircuits.com/controlling-an-h-belt/. SCARA is probably a bit more complex (I haven't really looked into it), but with the powers of NumPy, I see no problem implementing at least a PoC in a fairly short time : )
Re: EMC2/Linuxcnc running on Raspberry Pi
July 21, 2014 03:54PM
Just to help simplify things a little:

The PI would be the replacement Computer, it does not take the place of Arduino or the Control Board, the Arduino can be used with GRBL or a DB25 style driver board can be used with it to run a machine.

If Power is a concern, consider using an external source, the Arduino and Rasberry PI are only for processing requests.

So it all boils down to two questions....
1.) Can you install Lynux CNC also known as EMC as an operating system on the RPI?
2.) How do you connect the driver of choice?

If you can install EMC as an OS then you can use the I/O's to interface to a DB25 Driver, or use two I/O's with Arduino as the controller.

Cheers,

Rob
whatisacnc.com
electric-canada.com (new)
Re: EMC2/Linuxcnc running on Raspberry Pi
August 01, 2014 01:56PM
Quote
crob09

If you can install EMC as an OS then you can use the I/O's to interface to a DB25 Driver, or use two I/O's with Arduino as the controller.

Cheers,

Rob
whatisacnc.com
electric-canada.com (new)

Its all possible, though ADC is not yet implemented so thermostat temperature monitoring would need that implemented.

There maybe hope that a full kit will be available via a kickstarter project funding soon, I doubt there will be enough people interested to reach a funding goal though.

The costings looks like $100 for 5 axis kit of 0.5Nm stepper motors (all parts 24vpower/5x stepper drivers/5x motors/extra components for ADC and other io/cables/etc including model A raspberry pi), but large numbers of orders would be required to get prices down to that level.

linuxcnc runs pretty well at present but needs some tuning to fully optimise performance.
Sorry, only registered users may post in this forum.

Click here to login