Friday, 10 February 2017

geeetech Reprap Smart controller LCD12864 on re-arm controller

I finally got my re-arm!



https://www.kickstarter.com/projects/1245051645/re-arm-for-ramps-simple-32-bit-upgrade in case you some how missed it.


I set it up following the quick start guides on http://panucattdevices.freshdesk.com/support/solutions/folders/1000226299
Installed the latest firmware, no issues, used the eg config.txt and basic commands worked as expected. (just the controller powered over usb at this stage)

Then I went to plug in my GLCD, which I gave up on on using atmega based machines a long time ago as being too resource hungry.

Problem..   The re-arm supports the reprap discount GLCD, I have a geeetech GLCD, close, but not identical.

The documentation show this following image




And they provide the special cable with the separated 5v line.

If you look at this image you notice you cannot see the key on the lcd adaptor sockets. They are are the back side from this view.

Now if we take a look at the geeetech one
You can clearly see that the key on the ramps lcd adaptor is on the opposite side.  So we cannot use the provided special cable as the key makes us plug it in backwards breaking out the wrong pin.

I checked out the circuit and it looks compatible apart from the socket keys.

I wired it in using some prototyping wires




You only need 7 cables.
Lets define Top left on the adepter and the GLCD pictured as pin 1, and bottom right is pin 10.
Its simply wired pin 1 to pin 1 and pin2 to pin 2 up to and up including pin 5.
Then skip to pin 9 (black, gnd), which also goes to pin 9
On the GLCD pin 10 (red) is the 5v supply and needs to be wired to the 5v line of the re-arm as pictured in the guide.

And setup the firmware, as documented.


# Panel See http://smoothieware.org/panel
panel.enable                                 true            # set to true to enable the panel code
# Example reprap_discount_glcd
panel.lcd                                    reprap_discount_glcd             # set type of panel
panel.spi_channel                            0                 # set spi channel to use P0_18,P0_15 MOSI,SCLK
panel.spi_cs_pin                             0.16              # set spi chip select
panel.encoder_a_pin                          3.25!^            # encoder pin
panel.encoder_b_pin                          3.26!^            # encoder pin
panel.click_button_pin                       2.11!^            # click button
panel.encoder_resolution                     4                 # override number of clicks to move 1 item (default is 4)
#panel.button_pause_pin                      1.22^             # kill/pause set one of these for the auxilliary button on viki2
#panel.back_button_pin                       1.22!^            # back button recommended to use this on EXP1
panel.buzz_pin                               1.30              # pin for buzzer on EXP2


This mostly works! (yea I haven’t remove the protective plastic yet)
But the encoder is backwards.



To fix this you just need to tweak the provided config a little.

Just swap the encoder pins over

panel.encoder_a_pin                          3.25!^            # encoder pin
panel.encoder_b_pin                          3.26!^            # encoder pin

becomes

panel.encoder_a_pin                          3.26!^            # encoder pin
panel.encoder_b_pin                          3.25!^            # encoder pin

The GLCD and encoder work as expected now.


NB I have not tested the SD card at this time.

Sunday, 5 February 2017

Adding a LJ12A3-4-Z/BX NPN Inductive Proximity Sensor to a RAMPS

In building the hypercube printer I wanted  to add an inductive sensor for the Z endstop/probe

I specifically wanted a 12v sensor so as not to load down the already over taxed 5v rail on the RAMPS. 

The main issue is that this sensor has a 12v output and the mega IO pins are 5v input max.

Commonly other have used a 10k and a 15k resistors as a voltage divider so that the output is 5v.  This did not work on my sensor, the result was more like 3v. Which is not high enough to count as a logic high. My sensor seems weird.. I needed to tweak the values.

Second issue, Power.  I didn’t want to run separate power from the supply. The 2 pin 12v ramps connector is already used for hotend fan and I didn’t want to tap into that. I wanted a solution I could just plug in.



My solution was a little unique (well I've not seen anyone else doing this trick)

I'm going to use the E1 socket for power and signals.

This is the result


Note the E1 motor connecter is directly plugged into the inductive sensor and the endstop IO line.


The details.


The circuit is still just a simple voltage divider, but using a variable resistor so the output voltage can to tuned. 


If you look at the pololu pin outs



On the right hand side you see the first 2 pins are VMOT and GND.  That is 12v power, and I will use that for the probe.

The next 4 pins are the 4 stepper motor pins. On the ramps these only go to the stepper plug, so can be reused. I redefined them as +12v, gnd, signal_raw and signal_ttl.

The probe:

Wire up the 3 wires of the probe into a 3 pin plug in the order +12v, GND and signal_raw. Plug this into the E1 "stepper" header, making sure to get it in the right location and orientation. (+12v is pin closest to ramps power plugs)

The board:

Next we build up a simple replacement module, I used vero board

Cut out a piece of vero 7*4 holes in the following orientation.
I used  8 * 4 just to make it a little more pololu sized

Ignore the nick out of the side and the top, these are not deliberate.

The top line will plug into the pololu socket, top left is column 1, row 1 for the following notes.

Add a 10K resistor to the board, on the copper side (connects to columns 2 and 6)

This could be under the board if you really want. (or if your variable resistor doesn’t have clearance to sit over it)

Next add in the variable resistor, I used 20K

This is wired from column 5 row 2 to column 6 row 4. NB column 7 is also now electrically live, but is not used. Make sure you don't connect this to anything (ie don't put in all 8 mounting pins, without isolating this from pin 7)

Add in the power wires.

This is the underside. So column 1 is at the right.
12v (red) is connected from column 1 to column 3
GND (black) is connected from column 2 to column 4

The top now looks like this


Next add in the 6 connecting pins.


 Bottom view

Testing:

Apply +12v to pin 1 and GND to 2 of the connector
Attach your inductive probe to pins 3,4 and 5 (12v, GND and signal_raw)
Attach a multimeter to GND and pin 6 (signal_ttl)
Adjust the variable resistor till you get a nice 5v out. Check that when its triggered the voltage still drops to about .5v    
 

All going well you can now just plug the adaptor into the E1 socket.

Now all you need to do is wire up signal_ttl to your Endstop signal line.
in the first result image above this is the green wire from the Z min endstop signal line to the 4th pin of what used to be the motor connector.

NB if you over volt the ramps 12v 5amp input (ie use a single 13v supply on both power inputs generally used make the bed heat faster, make sure you re adjust the variable resistor so the output is still 5v.)  


Objective achieved. A plug in play solution for a 12v NPN Proximity Sensor that doesn’t involve splicing cables for power, or nasty cables with inline resistor divider circuits.