Raspberry Pi i2c communication with Arduino boards

Hi,

Has anyone used the i2c bus to connect the raspberry pi and a mini rambo together to avoid the usb->serial bus for sending G-Code? Seems doable if the pi is the master (3V vs 5V sinks), and might avoid the usb bottleneck in the zero w I saw someone mention in another forum. If the usb in the mini rambo comes from 12V and usb is isolated, (it isn’t needed for power,) so it would be a replacement rather than an addition, still 4 wires but no ch340 to deal with or whatever usb serial device is being used.

I have read it being possible with arduino uno boards, even multiple masters, no idea of the performance, but this is sending bit of text around, it’s just waiting for responses that make it slow. Apparently the registers provided let you do things like turn on leds and such.

Cheers!

I think maybe you meant UART, instead of usb. That is possible (and relatively common). The prontoneer picnc shield uses UART to talk to the arduino nano. You can do this with the rambo, or another Marlin board.

Marlin isn’t set up (AFAIK) to use I2C, except to control the display.

I don’t think it is worth it though. USB is faster than serial. I don’t think you’ll get any faster. The SD card is still quite a bit faster.

Hi,

I am thinking of potential issues on my pending build, one is having the pi connected to a mini Rambo with a usb cable subject to motion jiggling it around on a lowrider 2. So, in that sense I mean usb. Also the retro usb connector used comes is a variety of long lengths and quality, and is less than ideal. Not unsolvable problems given enough rubber bands and chewing gum, but… :slight_smile: Smaller wires connected to pins could help with that, easier to fit in a box with the normal mess.

Few options come to mind, use the serial tx/tx pins to avoid the usb-serial conversion / device, or use SPI. I am adding a e-ink display to my pi, and it has a breakout connector for SPI expansion with pin connectors, if the mini Rambo has a full SPI setup with input and output that might work too, it should as the scard part works. Not using the scard/budget display, so those mini Rambo pins are freed up. Would need to do up something on the firmware side, maybe there is a library to be imported, space permitting.

I just like the idea of the i2c bus better than spi, addresses instead of chip selects. No idea about performance, speed should be limited by the hardware more than anything, I am more interested in it not stopping in the middle of doing something because of cable/communication issues, read everything from AliExpress. :slight_smile: Missing steps, sure, slow it down, or tighten belts, random stops for no reason wasting hours of time, maybe avoid bad solutions, but it could be that everything is perfect with a mini Rambo and there is no need to anticipate problems.

Oh, btwI am also a Linux user since windows decided it didn’t like me unplugging everything when changing cases, and self destructed so it wouldn’t boot. Feels like being on a seesaw, you try to have fun but the 800 pound gorilla on the other end wants what it wants. :slight_smile:

Cheers!

The trouble with spi or i2c isn’t the available ports (or cpu peripherals), it is the firnware software. Those features are used for Marlin to control something else. When you print from the SD card, Marlin is sending commands to list the files on the SD card, and read lines from it, which it then sends to its gcode interpreter. It isn’t expecting octoprint to be over there.

Serial tx/rx would work fine. It would be basically the same as USB, except you would be using the raspberry pi serial hardware instead of the USB chip, and you would be skipping the usb chip on the rambo. It would work without changing any of the software (although you may need to tell the pi to stop using that serial port, and tell octoprint it is ok to use that serial port).

USB also works just fine. I have my pi attached to the same board as the mini rambo, and I have a 6-12" USB cable (AB) and it works just fine. There isn’t enough mass for it to shake loose. But if you are worried, you could always apply the industry standard of hot snot (hot glue).

The one place we have trouble is when the CAM software is configured for something like trichoidal milling (adaptive clearing). The bit moves in little tiny circles, that move forward to make a slot wider than the bit. This means a lot of tiny arc commands or a lot a lot of tiny line segments. This is a really specific problem, and if you’re doing this, the best mitigation is to tune the arc stuff in Marlin config (which Ryan has done a pretty good job on, in recent versions) and use an SD card and LCD. Octoprint or the pi just won’t be fast enough. You can upload a file over wifi directly to an attached SD card installed in the printer, but it is really slow, and if you’re doing it with a big file (with trichoidal milling) you will find it easier to just use the sneaker net to copy the file to the SD card. You might be able to find a standalone SD card to connect, without the whole screen. Then you could install it on the side of your electronics enclosure and make it more accessible.

Honestly though, once you actually set it up, you will find it works fine, and you won’t really notice any problems. Even most people who do trichoidal milling don’t notice any problems.

1 Like

Hey, thanks for the reply, I’m excited for the deluge of parcels coming in the mail. :slight_smile:

Having looked further into the SPI on the rambo mini, it is software based, basically purposed general i/o pins (good enough for a simple display), that doesn’t seem to be any more solid that uart, probably slower. So it’s not a faster, more robust lane. In theory the standard is potentially faster, just not this implementation. Not 100% how fast the SPI is on the pi is either, come to think of it. Regardless, I am sure things in general will be fine initially, no doubt upgrades will come down the road.

The idea is of the lowrider is simple enough, it feels like something I would come up with, if not get working properly. I recently had the idea of a lowrider with an air brush attached making swooping motions with actuators controling the rate of spray, then I could gcode some ghost flames. Probably not practical, paint everywhere, clogged nozzles, etc, some kickstarter had carburator attached to a phone doing something similar, took them ages to get that going apparently.

Anyway, I found a 5" usb cable that came with one of my projects that I can use, it has to plug into the micro usb adapter, the momentum of that should be fine, some hot glue on the pi’s micro usb port should take care of it, it just seems loose. It doesn’t have the metal slug like my other cable, maybe I can find something to clamp on, if it becomes a problem.

I will probably be starting with foam or cheap plywood, curious how plywood will withstand chipping, aluminum probably not for a while, sounds cool though. Or maye I will start just drawing big ass images. :slight_smile:

Thanks for the encouragement. :slight_smile: