# Arduino + Relay Puzzle

**URL:** <https://community.inventables.com/t/arduino-relay-puzzle/45569>\
**Category:** Troubleshooting\
**Created:** [November 18, 2017, 4:08pm UTC](https://community.inventables.com/t/arduino-relay-puzzle/45569 "2017-11-18T16:08:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![HaldorLonningdal](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/haldorlonningdal/32/72377_2.png) [@HaldorLonningdal](https://community.inventables.com/u/HaldorLonningdal)\
**Post date:** [November 18, 2017, 4:08pm UTC](https://community.inventables.com/t/arduino-relay-puzzle/45569/1 "2017-11-18T16:08:35Z")

</div>

I have searched without locating my breaking point and now hope for a little guidance from this forum:

Backdrop:  
DIY-CNC controlled by Arduino UNO  
GRBL 1.1f  
Easel 0.3.10  
Automatic Spindle enabled in Machine Setup.

Arduino Pin12 (Spindle Enable)  
[http://domoticx.com/wp-content/uploads/Arduino-grbl-pin-layout.jpg](http://domoticx.com/wp-content/uploads/Arduino-grbl-pin-layout.jpg)

Wether I have spindle ON/OFF, during Machine Setup test or at Easel Carve I read 4,8V at Pin12.  
I can command Coolant Enable through M8/M9 and measure 5.0V at A3, pin Pin12 is at 4,8V regardless.

What am I missing or where should I take a look?

Also, the relay I have trigger when pin go low (0V), is there a software get around to that or do I need to flip the signal through hardware?  
Relay in question below.  
[![](https://core-electronics.com.au/media/catalog/product/cache/1/image/650x650/fe1bcd18654db18f328c2faaaf3c690a/d/e/device17_1000.jpg) ](https://core-electronics.com.au/media/catalog/product/cache/1/image/650x650/fe1bcd18654db18f328c2faaaf3c690a/d/e/device17_1000.jpg)

---

<div class="post-metadata">

**Author:** ![LarryM](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/larrym/32/51450_2.png) [@LarryM](https://community.inventables.com/u/LarryM)\
**Post date:** [November 18, 2017, 4:26pm UTC](https://community.inventables.com/t/arduino-relay-puzzle/45569/2 "2017-11-18T16:26:06Z")

</div>

You are looking at a version 0.8 connection diagram. After version 0.9 the Z limit switch was moved to D12 and then D11 was assigned as the PWM output for variable spindle speed motors (also used for IoT hook ups).

You could also repurpose “Spindle Direction” to be a 'Spindle Enbable" function by changing config.h, but D13 is a shared resource so you have to be careful if you want to use it as “Spindle Enable”.

You can flip the logic of the A3 pin with a #define parameter in config.h and recompile grbl to get that functionality.

// Inverts the selected coolant pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful  
// for some pre-built electronic boards.  
// #define INVERT\_COOLANT\_FLOOD\_PIN // Default disabled. Uncomment to enable.  
// #define INVERT\_COOLANT\_MIST\_PIN // Default disabled. Note: Enable M7 mist coolant in config.h

---

<div class="post-metadata">

**Author:** ![HaldorLonningdal](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/haldorlonningdal/32/72377_2.png) [@HaldorLonningdal](https://community.inventables.com/u/HaldorLonningdal)\
**Post date:** [November 20, 2017, 7:52am UTC](https://community.inventables.com/t/arduino-relay-puzzle/45569/3 "2017-11-20T07:52:15Z")

</div>

Thank you @LarryM

I get the broad strokes and will look into this shortly.

---

<div class="post-metadata">

**Author:** ![HaldorLonningdal](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/haldorlonningdal/32/72377_2.png) [@HaldorLonningdal](https://community.inventables.com/u/HaldorLonningdal)\
**Post date:** [November 20, 2017, 8:09pm UTC](https://community.inventables.com/t/arduino-relay-puzzle/45569/4 "2017-11-20T20:09:38Z")

</div>

D11 worked just as you said it would, diving into config.h to invert Spindle Enable and recompile 🙂

---

<div class="post-metadata">

**Author:** ![HaldorLonningdal](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/haldorlonningdal/32/72377_2.png) [@HaldorLonningdal](https://community.inventables.com/u/HaldorLonningdal)\
**Post date:** [November 21, 2017, 12:51pm UTC](https://community.inventables.com/t/arduino-relay-puzzle/45569/5 "2017-11-21T12:51:56Z")

</div>

@LarryM

Pardon my ignorance but in order to compile a custom config.h is it a requirement to recompile into a hex-file or is it enough to alter the config.h located in Arduino Library, load the grbl library into Arduino IDE and Verify/upload directly to the UNO?

---

<div class="post-metadata">

**Author:** ![JustinBusby](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/justinbusby/32/30906_2.png) [@JustinBusby](https://community.inventables.com/u/JustinBusby)\
**Post date:** [November 21, 2017, 1:05pm UTC](https://community.inventables.com/t/arduino-relay-puzzle/45569/6 "2017-11-21T13:05:34Z")

</div>

You can upload directly from the Arduino IDE with a modified config.h

---

<div class="post-metadata">

**Author:** ![HaldorLonningdal](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/haldorlonningdal/32/72377_2.png) [@HaldorLonningdal](https://community.inventables.com/u/HaldorLonningdal)\
**Post date:** [November 21, 2017, 1:18pm UTC](https://community.inventables.com/t/arduino-relay-puzzle/45569/7 "2017-11-21T13:18:53Z")

</div>

Thank you @JustinBusby
