Skip to topic | Skip to bottom
Home"Wealth without money..."

Main.ArduinoRepRap1_0r1.2 - 12 Dec 2008 - 20:54 - AdrianBowyertopic end

Start of topic | Skip to actions

Arduino setup and programming

single arduino with valve

This is the easiest setup there is. We've done some creative wiring/coding and figured out how to run an entire RepRap machine off of a single Arduino! The Arduino can simply be powered directly off the USB port of your computer. The only real downside is that the code takes up most of the space on the Arduino, and every single pin is in use. Basically, there is not much room for hacking either the firmware or the electronics... but it will definitely get you printing in a minimum of time and effort.

The Max endstops are optional; they are seldom used in practice.

Click for bigger image.


Mounting and Wiring

There are two alternatives here. You can put all the electronics in one place, and run wires from it to the components of your RepRap machine, or you can clamp the various circuit boards to the machine next to the devices they control and run control signal wires to them from the Arduino.

Electronics all in one place

First, find or cut a flat piece of thin plywood, about 12" x 12".

Next, place all your boards on the wood so that each board is close to where it will be wired to. Mark with a pencil through each hole, and also optionally around each board for drill holes and as a board outline.

Then, take all the boards off and drill out each drill mark with a 3mm (1/8") drill bit.

Take a foot or so of silicone aquarium tubing and cut 5 mm (1/4") lengths of it. You will be using these to mount the boards to the wood. Optionally, you can use spacers if you want a more professional look.

Now, mount each board on to the wood with M3 x 15mm bolts. Use washers on both sides, and use a short piece of tubing between the board and the wood for spacing (and shock absorbtion). Tighten down the nut by hand, and then a little bit with pliers or a wrench. It should be solidly attached, but not wrenched down too much. (For the brits: dont use too much welly wink

Once you have the boards laid out and mounted, its time to wire them up. Currently, there are 3 different ways to hook the boards up to your Arduino:

  1. Strip 1/4" from the end of the wire, and stick it directly into the header on the Arduino. This is the easiest, but also most prone to failure (the wires will vibrate out, break, etc.)
  2. Solder the each wire to a .100 pin strip, and plug that directly into the appropriate spot on the Arduino. This is the hardest method, but it is the most permanent. The downside is that its hard to reconfigure your system without resoldering everything.
  3. We are working on an Arduino breakout shield which you will insert into the Arduino and provide the same access to the pins, but in a screw terminal form-factor. It will be a nice blend of easy configuration, with a strong, semi-permanent connection.

Electronics distributed around the machine.

electronic layout

There are U-shaped PCB clamps in the RP parts for RepRap. These allow PCBs to be clamped to the 8mm rods that form the frame.

X, Y, and Z are the stepper controls for those axes. M is the microcontroller (this is the Sanguino, but the Arduino goes in the same place). The extruder control boards are at E behind the X stepper on the carriage.


Program the Arduino

You can set the Arduino up to communicate with the host using G Codes, or with the SNAP protocol that we used for the original PIC-controlled RepRap. New users should go for G Codes.

Program the Arduino to talk G Code

GCode Interpreter

/gcode/GCode_Interpreter/GCode_Interpreter.pde - this is a GCode interpreter that runs on the Arduino. We have added special commands to it so that it can control a RepRap machine.

More information here.

Program the Arduino to talk SNAP

Once you have everything wired up and ready to go, its time to program the Arduino with the appropriate firmware. There are a few simple, easy steps to do this:

  1. Download and install the most recent Arduino program.
  2. Download the most recent RepRap Arduino firmware source.
  3. Copy the folders in the library folder of the file above into your Arduino library folder (arduino/hardware/libraries)
  4. Open the appropriate firmware in the file above and upload it to your Arduino board(s).

The appropriate firmwares are:

Single Arduino

/snap/Single_Arduino_SNAP/Single_Arduino_Snap.pde - just upload this file and you're good to go!

Once you have compiled and uploaded your firmwares, you should be good to go! Fire up the RepRap host software, double check that you've specified the proper serial connection, and you should be good to go! We recommend using the various exerciser programs to test each part of your machine before you go ahead and print stuff. If all goes well, then you'll be printing in no time.

Update Temperature Settings

Since the Arduino based electronics emulate the PIC style of temperature measurement, you may need to update certain temperature settings in the firmware and in your reprap.preferences file on your host computer. The default is setup for the RRRF 100K thermistor, and you will need to change values if you are using a different thermistor.

  1. Lookup the values for your thermistor.
  2. In the ThermoplastExtruder subdirectory of your Arduino library, create a symbolic link to the appropriate file (which will be something like Thermistor_r0_100000_t0_25_r1_0_r2_4700_beta_3960.h) called TemperatureSensor.h.
  3. Delete ThermoplastExtruder.o (if it exists) This is the old object file and will force the library to recompile.
  4. Run the host software for driving RepRap on your computer. Select Files->Preferences->Extruder_0
  5. Change Extruder0_Beta(K) to 550.0, Extruder0_Capacitor(F) to 0.000003, and Extruder0_Rz(ohms) to 4837 regardless of what your actual thermistor values are. Click on OK.

After that, you'll need to re-compile the firmware and re-upload it to your Arduino.

If you are using a K-type thermocouple and the RepRap thermocouple PCB, follow the above procedure, but link the file Thermocouple-type-K.h to TemperatureSensor.h.

Setup Host Software

Install the RepRap host software as normal. Instructions are located here.

Once you have the host software installed, open the software and pull up the Preferences menu. Switch to 'Extruder0' and change the preferences stated to the values below:

Preference Value
Extruder0_Beta(K) 550.0
Extruder0_Capacitor(F) 0.000003
Extruder0_Rz(ohms) 4837

The reason for this is that the Arduino emulates the PIC temperature measurement system with an 'ideal' thermistor. Those values are hardcoded into the header in ThermoplastExtruder_SNAP_v0.h. If you change the values there, make sure you update your host prefs too.

-- AdrianBowyer - 12 Dec 2008


to top

I Attachment sort Action Size Date Who Comment
single-arduino-with-valve.png manage 115.2 K 11 Dec 2008 - 21:31 AdrianBowyer single arduino with valve
single-arduino-with-valve-small.png manage 113.4 K 11 Dec 2008 - 21:30 AdrianBowyer single arduino with valve
electronic-layout.jpg manage 305.9 K 12 Dec 2008 - 17:26 AdrianBowyer electronic layout

You are here: Main > RepStrap_1_0_Seedling > Generation2Electronics > ArduinoRepRap1_0

to top

Copyright © 1999-2009 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding RepRap? Send feedback