horus-fw

The Horus firmware is a program that allows you to control the stepper motors, laser modules and LDR analog sensors using G-code1 commands. It is compatible with Arduino2  based boards and the ZUM SCAN3 shield.

The firmware has been designed to control all physical elements of the Ciclop4 3D scanner, a rotating scanner based on laser triangulation. The base of the code is the Grbl5 project, a program that enables CNC machines to be controlled. It has also been used in other projects such as Marlin, the firmware for 3D printers.

gplv3-logo

The code has been published on Github, released under the GPLv3 licence6. This licence guarantees the fundamental freedoms associated with the use of open source software. Any code released under this licence automatically becomes part of the Technological Heritage of Humanity.

Compiling and loading


Different interfaces may be used to compile the Horus Firmware, such as de Arduino IDE7  and Sublime with the Stino8 plug-in, etc. These interfaces also allow you to load the compiled firmware in .hex format onto the microprocessor. Another way of loading the firmware is to directly use AVRDUDE9, or the most simple option is using the Horus software.

horus-ide

Uploading of the firmware using Horus (left) and Sublime+Stino (right)

More information is available in the Grbl wiki, in the compiling and flashing sections.

Connection


You can communicate with the board via USB or Bluetooth. There are different open source applications for establishing the connection, such as the Arduino Serial Monitor or CuteCom10. If the latter is used, you will need to select the device, adjust the baud rate to 115200 and set the command ending to LF  or CR,  ‘\n’ or ‘\r\n’, respectively.

After starting the serial communication, this will be the first message that Horus sends:

Horus 0.1 [‘$’ for help]

After each command is received, the software will answer with ok when the processing of that command ends, either correctly or with an error  message. The communication flow is as follows:

→ G1 X360\r\n
← ok\r\n

arduino-serial-cutecom

Firmware communication using Arduino Serial Monitor (left) and CuteCom (right)

Configuration


The Horus firmware, due to its Grbl heritage, provides a configuring and monitoring interface which uses $ commands, as well as control commands in real time. All supported commands are described in the Grbl wiki.

Yu can also view the help menu on the available configuration commands by sending $:

$$ (view settings)
$# (view # parameters)
$G (view parser state)
$I (view build info)
$N (view startup blocks)
$x=value (save setting)
$Nx=line (save startup block)
$C (check gcode mode)
$X (kill alarm lock)
~ (cycle start)
! (feed hold)
? (current status)
ctrl-x (reset)

As an example, the commands $110=v y $120=a, adjust the speed and maximum acceleration of the motors to v º/s and a º/s² respectively.

G-code commands


G-code is the most widely used programming language in numerical control devices (CNC). Milling machines, laser cutters and 3D printers use this de facto standard to communicate. Instructions are executed sequentially in this language. These are the G-code commands that have been integrated into Horus:

G1: Circular movement

G1 Fv  Adjusts the rotational speed to v degrees per second
G1 Xd  Moves the stepper motor to the position d defined in degrees

M0–M2: Pause and program end

M0  Pauses the program. It may only be restarted through the Cycle start (~) command
M2  Stops the program and resets it

M17–M18: Enable / Disable the stepper motors

M17  Enables the motors, maintaining their position. They stay enabled even after sending G1 commands
M18  Disables the stepper motors. They stay disabled even after sending G1 commands.

M50: LDR analog sensors reading

M50 Tv  Reads the LDR sensor connected to pin v. Returns an integer between 0 and 1023

M70–M71: Laser modules turn on / off

M70 Tv  Turns off the laser module v
M71 Tv  Turns on the laser module v. After a four-minute timeout, the laser is turned off automatically

Future work

One of the future projects is adapting the firmware to new electronic boards and new processors. The purpose is to increase its functionality and define a standard communication interface, which guarantees compatibility with tools like Horus and derivatives.

Horus Firmware has been developed with simplicity in the structure and code in mind. For example, it contains just enough for controlling 3D scanners such as Ciclop, while easily enabling you to add functionality. As with all open source projects, we encourage you to contribute, improve and evolve this firmware and adapt it for new requirements and projects.

Let’s code!

References

  1. G-code commands
  2. Arduino community
  3. ZUM SCAN power shield
  4. Ciclop open source 3D scanner
  5. Grbl CNC control software
  6. GPLv3 open source licence
  7. Arduino IDE
  8. Sublime Text IDE and Stino
  9. AVRDUDE programming software
  10. CuteCom communication interface

13 thoughts

  1. Pingback: Horus Firmware released under GPL | DIWO | 3D p...

  2. The link to Github is grbl,not the Horus firmware~. And I can’t find horus firmware on Github. It will be great if we can see the source code of horus firmware. Thx~

  3. Hello,Thanks for you share , I am not clear about the LDR for what,May you help me explain ? Thank you in advanced !

    1. Jesús Arroyo

      Hi Johnson,

      Horus FW is oriented to 3D Scanning. LDR sensors are implemented in order to be used in the future to, for example, auto-adjust the exposure of the camera with ambient light. Moreover, you can connect any analog sensor, apart from LDR.

      Regards.

      1. Hi Jesús Arroyo,Thank you very much !Have a nice day!

  4. It seems the horus-fw.ino file on github is an empty file. GitHub indicates 0 lines, 0kb.

  5. Hi can anybody help in this issue

    Need help desperately – as motor is not moving at all
    And getting message in Horus software as”Check Motor Direction and Pattern Position and try again error” and motor not at all responding in control bench mode

    We built the ciclop using Arduino Uno + laser driver and stepper motor driver on a prototyping shield.

    Items used are :

    Original Arduino UNO V 3.0
    A4988 driver stepstick + NEMA17 motor
    2 Line laser modules – driven through ULN2003 from UNO
    4.Logitec C270 HD webcam
    3D printed and assembled scanner
    Electronics assembled on a Arduino prototyping shield
    12V DC – 3Amps Power supply used to power Arduino UNO and module’s VMOT pin is connected to Vin pin of Arduino UNO

    Pin connections are :

    Motor Step – Uno pin number 12
    Motor Dir – Uno pin number 13
    Motor Enable – Uno pin number 9 (with 10K pull-up resistor)
    Laser 1 – Uno pin number 2
    Laser 2 – Uno pin number 3

    After assembling the shield , we have loaded ‘firmata’ sketch and used firmata.exe (firmata testing program), and enabled one -by-one the relevant pin and ensured motor can rotate and also laser can be switch on or off – this is just to ensure all the wiring is ok.
    In this everything worked fine.

    I tried loading the three different firmware through below three procedures , and still my motor will not move at all in all the cases

    Procedure 1 :

    Wiring done as per below :

    Motor step – 12th pin of UNO
    Motor direction – 13th pin of UNO
    Motor Enable – 9th pin of UNO (with 10K pull up)
    Laser 1 – 2nd Pin of UNO
    Laser 2 – 3rd Pin of UNO

    Source of Firmware :
    http://diwo.bq.com/wp-content/uploads/2015/01/horus-fw.zip – I took the HEX file

    Method of loading the firmware
    Used Horus software version 0.1.2.4 to upload the firmware – under preference – Burn Firmware option – selected Arduino UNO as option – selected the external file – and showed the path of downloaded Hex file and uploaded it , It uploaded without any error. (tried EEPROM clear option also – but with same result as below)

    Result :
    In Horus under GCode control – issued $X and unlocked the alarm , and then we could ON/OFF lasers fine, enabled motor in control workbench but motor will not move !! at all.- and upon “enabling ” motor in Horus still the motor will not lock even (means the motor enable pin from does not go LOW to enable the motor).

    Procedure 2 :

    Wiring is same as Procedure 1 :

    Source of Firmware :
    https://github.com/bqlabs/horus-fw (it is the source code not the hex file )

    Method of loading the firmware
    Used Arduino IDE 1.6.5 to open the source code , and compiled with no errors and upload the firmware using Arduino IDE itself with no error on to the Arduino UNO.

    Result :
    In Horus under GCode control – issued $X and unlocked the alarm , and then we could ON/OFF lasers fine, enabled motor in control workbench but motor will not move !! at all.- and upon “enabling ” motor in Horus still the motor will not lock even. (means the motor enable pin from does not go LOW to enable the motor).

    Procedure 3 :

    Wiring is same as Procedure 1 :

    Source of Firmware :
    Used Horus 0.1.2.4 inbuilt default firmware

    Method of loading the firmware
    Used Horus software version 0.1.2.4 to upload the firmware – under preference – Burn Firmware option – selected Arduino UNO as option and selected inbuilt default firmware to load,
    it loaded without and error.

    Result :
    In Horus under GCode control – issued $X and unlocked the alarm , and then we could ON/OFF lasers fine, enabled motor in control workbench but motor will not move !! at all.- and upon “enabling ” motor in Horus still the motor will not lock even. (means the motor enable pin from does not go LOW to enable the motor).

    Can you please help , what is that we are missing

  6. Hoi i am building the ciclop i love your work
    I was looking to amp up the resolution is there a form or topic where i can find some more persons working on this i wil share al my finding ..again love the work tanks

Comments are closed.