RDB functions description

From RepRap
Jump to: navigation, search
RDB Build Documentation


Farm-Fresh lightbulb.png This page provides an short introductory and very generic presentation of functions, with context, possible implementations and considerations. It may or may not be applicable to a certain case or board. A function is considered to be a group of hardware components that provide a certain utility and are interfaced to a development board through one or more input/output pins.


Temperatures

Thermistors are by far most common temperature sensor used. In the common implementation thermistor is part of a voltage divider, and when temperature changes its resistance changes and the voltage output of the divider changes. This voltage output is taken by microcontroller adc pins, passed through a set of comparators and compared to Aref voltage (which is usually =logic voltage) and reported as a adc value which simbolizes that voltage level is at a certain place proportionally between 0v and vcc voltage. So the microcontroller knows that voltage in comparison to its internal voltage, but other than that, the system does not have any reference point to deduct whats real temperature. Further on, the user provides a table that indicates what adc values correspond to what temperatures. A certain adc value is referenced in the table and from those values the current temperature is deducted. So the system does not work with temperatures, but with adc levels which are reported as temperatures based on a user table. So if the table is wrong, so are the temperature readings. For example if the table has temperatures in range of millions degrees, that is exactly what firmware will report: millions of degrees.

Because the system response to temperature is not linear, and because there are many places that can give errors, its important to understand that the temperatures reported by firmware are hypothetical, and not the real thing. With a fairly a simple procedure of calibration, thermistor tables can be tweaked to show readings that are closer to reality.

Because many users just copy-paste thermistor tables, and because errors sum up and become relative bigger at high temperatures, its probably common practice to have temperatures in range of 220-240 C being reported with 10-20-30 C degrees error, with thermistor tables that have not been calibrated.

Thermocouples are much more expensive than thermistors. Their advantage is that in one form or another, they do come with a reference point (usually a circuit on the waffer ic). This makes their temperature to be the real thing. Besides price, another disadvantage is these require an IC to work with. There are thermocouple IC which give analog output, which can be read by microcontroller's adc pins (example old AD595 and its replacements). This analog output configuration is very sensitive to noise, only a few milivolts in noise can give a notable reading fluctuation, and reprap machines are quite noisy. There are thermocouple ICs which report the temperature over comms, but this uses the comms and also requires specific firmware implementation (example MAX6675).

Switching

In the simplest way, switching refers to interrupting the current flow in a line. Low side switch stands for where the switch is located in circuit topology. In this case current flows from V+ into the load (heater or else), then from load to the low side switch, and from switch to the ground. In comparison a high side switch would interrupt the voltage before it reaches the load. On short, low side switching is cheapest and easiest to implement, and typically provides faster switching speeds. High side switching is more complicated and expensive to implement, and at bit slower, though it can be made to switch faster but with extra complications.

Heated bed, hotend, and even fans are controlled with low side switches. Because the switch (usually mosfet) interrupts the gnd side of the load, and the load takes V+ directly from psu, the load voltage can be 12v, 24v, or else, doesnt matter much as parameters are within switch specifications.

Usually the switch is a mosfet, because mosfets are fast, and its a n-type because its simple to implement. So N-mosfets are used, in our case the 3 pins are used as drain(V+), gate(logic control) and source(gnd side). Simply put, the voltage from gate to source (gate voltage, logic level) controls how much current is allowed from drain (V+) to source (gnd). Power mosfets have their own requirements, most important one is that it needs to be either fully closed or fully open (in saturation). A mosfet is "half-open/closed" when it allows passing of less current than line wants to give, and some current remains not sinked on the V+ side, in which case voltage across mosfet terminal increases, causing huge power dissipation in mosfet, and then mosfet will either be destroyed or will enter thermal protection. So it is important to select a mosfet which will be fully open when its gate is at the logic level that microcontroller supplies.

Endstops

Endstops are usually microswitches or optical slotted type. But one could try interface other sensors like inductive or reflexive ones.

NO and NC terminology: NO stands for normally open and NC stands for normally closed. Using NO types means the output pin is floating, in normal state nothing happens, and only when its triggered it closes and sends a signal, and this is generally good for power consumption. But for cnc world, a wire can come loose and then the machine will crash because that stop signal will never come. So in case anything happens, NO types are prone to fail at giving indication.

If NO setup would be used, then the signal loop would be normally open, and if sensor would get magically disconnected or malfunction, the system would not see any change, hence this setup is not wise. For safety reasons a closed loop is used, and in case something gets disconnected it will be interpreted like a stop and machine will know to stop. Therefore NC setup (normally closed) is preferred, and used in a closed loop configuration to achieve this functionality.

Inverted and non-inverted (about opto's output logic) or refered to as NPN or PNP (about inductive sensor's output stage) stands for output signal type. The sensor could sink the current on the line into ground, and by doing so, signaling a logic zero. Or could put a voltage on the line, which would signal a logic one. In both cases current flows thorugh the line at all times, so both are NC type and sort of a loop, the only difference is the direction the current flow.

Practically in one case some pullups (usually controller's internal one) will be active, and the endstop job is to sink that current into ground, keeping the line low as normal operation. In case the endstop is triggered, it will change to open state, disconnect the loop, and the pullups raise the line voltage at logic level. This is good configuration because the pullups inherently limit the current that is on the line, has fast falling edge, and the microcontroller pins can be simply diode protected. And because the signal which signifies "all good, everything ok" is realized by pulling the line to gnd, this config is not so much dependent on a particular logic level.

In the other case the sensor ("pnp" or "v+" or "Vo") output gives the voltage which keeps the line high in normal operation, and pulldowns are needed to limit the current sinking through ground and keep its voltage up. Its not such a great configuration because implies a junction drop, the line current is not inherently limited, and pins are not so easily protected, and sort of speaking, is more dependent on logic level than previous case (or to say, more components need to match that level).

There are some sensors which have both types of signaling (inverted or non-inverted), or at least with some support components can be easily configured both ways. Ultimatelly, and if needed, any kind of logic could be changed by a simple signal inverting circuit mosfet+pullup.

Notes:

  • could wire microswitches directly from development board itself with its gnd and supply;
  • ultimately could run without endstops at all, some firmware store the 0.0.0 as the position it had when powered up: sometimes this is very handy feature to avoid positional information loss when homing;
  • optical sensors are more consistent (repetitive) than microswitches and inductive/reflexive sensors, this is important for some loss of positional information when homing;

Stepper drivers

Stepper drivers are used to control the stepper motors. The stepper driver ICs receives move commands by Step/Dir lines.

  • Step signal is a sort of square wave, where each pulse corresponds to one incremental move, corresponding to which microstepping mode the driver uses.
  • Dir line changes direction: if its logic high motor moves one way, and if its logic low moves the other way.
  • Enable line is used to turn off the motors.

Notes:

  • there are other interfaces for communication between controller and stepper driver ICs, but step/dir is most common
  • there can be other features of driver ic or boards, like enable, sleep, reset, etc, and these may differ from IC manufacturer or may have particularities in the way they are implemented