I had an issue with my 3D printer where the SD card stopped responding. The system knows when one is inserted, but when I try to browse the folders it says that it can’t find the card. This is extra interesting, because recently I also had an SD card fail. (Seems like…) It’s a San Disk, so not just a no-name off brand, and at one point it was being used in the printer, I think. I used it a little while afterwards, but then when it was actually in a Raspberry Pi it stopped working when I rebooted. I’ve tried accessing if from Windows, Linux, and from the Arduino in the 3D printer, with at least 4 different card readers, and nothing worked. I’ve finally just about been convinced that it’s time to toss the card. I’m thinking about getting the scope out and seeing just what the signals look like to see if there’s any activity on the card at all.
I jumped through lots of hoops thinking that I was getting a response from the card, but I think at one point I had tried to mount the card in Linux but it actually created a mount point in the filesystem that then proceeded to trick me into thinking that sometimes I was getting a response. I don’t understand the mount system quite well enough to know what I did or to troubleshoot that. It’s gone now anyway, so I think I’ll put it behind me.
But now I’m setting up the new card for the Raspberry Pi. It will run Octopi to control my 3D printer. It is simple to just download the image for the SD card, and then to transfer it to the card with dd:
sudo dd if=2016-03-18-octopi-jessie-lite-0.13.0.img of=/dev/sdb bs=1M status=progress
I will also run the command sync to make sure all is in good shape before taking the SD card out of the reader. I don’t know if this is necessary once dd reports that it has completed, but I don’t like taking chances now that I’ve had one card fail.
When it’s run for the first time Octopi will expand the disk image to take up all the available space on the card, which is just what I want. Then point your web browser to the IP address of the Octopi server on your Raspberry Pi, if you know it. Octopi comes with Zeroconf set up, so if your computer supports it, you can just enter in it’s name and you will go right to it, without worrying about which IP address your router handed out to it. In that case you just browse to http://octopi.local and that’s all it takes. It will ask you to set up a user name and password to keep things more secure. It will also allow you to leave it unsecured, but doesn’t recommend that. I didn’t want anyone and everyone to take control of the printer if they were on the network, so I put in a user name. The kids might go crazy and not understand the implications of printing without having it prepared first.
For my use, this isn’t quite enough, even though it has plenty of functionality baked right in. I also want to be able to program the controller built into the printer. It’s an Atmega2560 chip, so it works as an Arduino Mega, which is how it’s programmed. I don’t plan to have a desktop GUI environment installed on the Octopi, so I’m more interested in putting on a command line tool. I found the Ino tool which will run all of the commands I want, and still keep full Arduino compatibility. (Well, at least it should. I haven’t yet used it beyond just checking that it would print the help file.)
There are some commands that I needed to run to set up my environment and get the tool ready to use.
First was to simply download the code needed:
git clone git://github.com/amperka/ino.git
My next attempt was to use ‘make install’ to install it like its instructions show, but that didn’t work out. I had to first install some dependencies.
sudo apt install python-setuptools python-config python-jinja2 python-pip
I then used Python’s ‘pip’ to install the other couple of needed things.
sudo pip install glob2 sudo pip install pyserial
I don’t know if they could have been done on one line, but that was the way I ran it, so I know it can work. Using these finally took care of all the error messages that I was seeing and I could finally run ‘make install’!
sudo make install
Now I can see the help page for ino, and it is all ready for the next time I want to be able to reprogram the printer with updated settings or a new driver.
But the story’s not quite over yet. Ino is a command and control package, but it doesn’t actually have Arduino built into it. It is made to take whatever version Arduino program you have and issue it commands to do the compiling and checking for you without having to open up the GUI and run it that way.
As an aside, the Octopi developers worked on some of the same stuff. They did it a little differently, but the end result looks at least similar. (I think the pip version of ino tools might be a bit older than the git version, but their way has fewer steps.)
I went ahead and installed Arduino from the repositories, even though that’s a bit outdated and it’s overkill, in that it pulls in quite a few dependencies from the X windows system. I would like to avoid that, since I’m running this headless, but I’m not going to spend the time at the moment trying to track down just what is needed and what isn’t. There’s a tantalizing sounding package called ‘arduino-core’ that could be all that is required, but I didn’t feel like taking the time to mess with it.
sudo apt-get install arduino
Though there were quite a few errors with it complaining of files not found, so that way might not end up being a good one, either. (Edit: I have some connection problems with other apt-get attempts from that Raspberry Pi, so it’s not just arduino. I’ll have to try again later.)