CNC Making of – Electronics

Hi everybody!

Last time I explained how I built the CNC structure and how the program works to control it. Now let’s see the electronic part. In this article I will give you some information regardin the software I wrote to control the machine..

Let’s get started!

The controller

For the controller I decided to use a Raspberry Pi 3 model B (then I replacd it with a model A).

I preferred it to the Arduino for three simple reasons:

  • I already had one 😁
  • I was very curious to learn how to use it
  • I wanted to make a completely homemade CNC, including the electronics, mechanics and software components

The Raspberry Pi 3 model B has the following features:

  • SoC: Broadcom BCM2837 Quad Core Cortex-A53 a 1.2 GHz, 32 kB L1 e 512 kB L2
  • GPU: Broadcom VideoCore IV Dual Core a 400 MHz
  • RAM: 1GB LPDDR2 a 900 MHz
  • Network: Ethernet 10/100, WiFi n 2.4 GHz, Bluetooth 4.1 + LE
  • Connections: microSD, HDMI 1.4 CEC, jack 3. 5 mm, 4Γ— USB 2.0 (SMSC LAN9514)
  • Interfaces: CSI, DSI, GPIO header 40-pin

Find more information at the link: RaspberryPi 3 model B.


At the beginning I preferred to use a breadboard to make the connections between the Raspberry Pi and the stepper motor drivers because I wanted to make the CNC circuit myself once the machine was working.

In general, the wiring diagram is more or less as follows:

where Step is the stepper motor control signal (each pulse causes the motor to advance one step) while Dir is the signal controlling the direction: when the Dir output is high, rotation takes place in one direction while when it is low it takes place in the opposite direction.

Once I tested the CNC I tried to create its PCB and replaced the breadbord (or at least part of it) with all its thousand coloured cables 🌈 whit the new circuit. The result was this:


Now the electronic part is like this:

The numbers 1, 2 and 3 indicate the connection cables to the stepper motors, one for each XYZ axis.

Unfortunately I haven’t been able to completely replace the breadboard yet because a the PCB is still not working properly as it suffers from the disturbances caused by the eddy currents generated by the brushed motor that I use as a tool (drill) and I will therefore have to make a separate circuit to control the motor. At the moment, if I connect it to the machine’s PCB without using the breadbord there is an interference with the stepper motors that causes uncontrolled movements of the axes.

In conclusion: there will be other things that can be improved/settled, but for now I am satisfied with what I have done and… there are other projects waiting for me! 🀩

See you soon πŸ˜πŸ‘‹πŸ»