Tuesday, August 2, 2016

Arduino Laserengraver


In short: If you want to control a laser engraver with a PC you'll need a microcontroller (connected via USB/WLAN to a PC) and drivers for the stepper motors. The microcontroller (in this case the arduino) needs software, which can take gcode-commands (coming form the PC) and turn these into signals for the motor-drivers. Thankfully this software already exists - it's called grbl (homepage on github, backup: zip-file). grbl is intended for three-axis cnc-machines. In order for the homing-function to work properly, you have to change the following lines in the config.h-file:


First, I wanted to build a laserengraver by myself. After several attempts though, I realized that buying a kit / something where everything already fits, would cost me less (in parts, time and nerves). So I bought the makeblock xy-Plotter with the Laserengraver head. If you are interested in building your own, a search on instructables might help you. Otherwise looking for projects on kickstarter might be a good idea (laserengravers/-cutters appear periodically).

makeblock xy-plotter with laserengraverhead
Since the laser burns stuff, you can get quite a lot of smelly smoke. Putting it inside a box / adding some venting is a good idea.


After the assembly and testing the recommended software, I managed to burn out one of the stepper-drivers. Not wanting to buy a new one and already having a plethora of electric components form my first attempts, I made my own pcb.

Laserengraver-contoller with Arduino Pro Mini

If you google grbl + shield you'll find that there are several people who have done the same and are selling their boards (there is even one for the raspberry-pi). If you don't want to buy one: I drew mine with fritzing and used the direct-toner-method for etching.
In order to control the laser (needs 12V DC) you can use the pin A3 (originally for the coolant-control).

Laserengraver wiring
Since the arduino can't output 12V you'll need a MOSFET to turn the laser on and off (Gcode-Commands M8 and M9). In the above picture the wiring for a 30N06LE N-channel MOSFET is displayed.

connections for grbl


In order to send g-code to the arduino/grbl-controller from your PC you'll need a programm like grblcontroller, UniversalGCode-Sender, bCNC, ... . In order to generate the gcode-files from pictures i use inkscape with the "J Tech Photonics Laser Tool"-plugin. If you want to turn dxf-files into gcode, have a look at CamBam.

Monday, July 18, 2016

WiFi - Nixieclock

finished clock inside the wooden case
In order to get a nixietube to light up, you need a rather high DC-voltage source (around 140V). With modern IC's it is possible to generate the environment needed, but switching the pins of the tube with a normal 5V-microcontroller (the arduino for example), calls for the right transistor. - You can of course find them online, but as it turns out (at least in my case), they're rather expensive and pretty small (SMD-size). Since I don't have the tools for such tiny electrical components, I decided to simply buy nixietube-modules for the arduino.

QS30-1 nixietube-module for arduino; Website/picture taken from: http://www.nixieclock.org/
You can buy mutliple of these modules and daisy-chain them toghether. Afterwards, you connect five wires to your arduino, add the library to your IDE (download zip), and use the example-code as a skeleton for your own implementation. So if you want to build a clock using these modules, you need an additional microcontroller and a RTC-module.

In my case, I used the DS3231 RTC and a arduino-compatible WiFi-breakout called "Wemos D1 R2". This way I could use the code from my previous post (Set RTC via WiFi) and simply add the nixie-library in order to control the tubes/show the date. For this setup I made a small single-sided pcb for the Wemos in fritzing:

single-sided pcb designed in frizting
As you can see, the pcb needs six jumper wires. - If you don't like that, you can always make it a double-sided pcb - or simply use nothing put jumper wires and leave it at that - the pcb is not required.

detail of the connection between the module and pcb
The wiring for the RTC is the same as described in the earlier post (Set RTC via WiFi). If you have a 5V-DC-powersupply lying around, you can simply use this one to power the Wemos and the nixie-modules. I hadn't, so I added a small DC-buck-converter to the assembly (connected to the upper four breakoutpins of "J2" → V in, GND in, GND out, 5V out).

Because the code for this project is too long for this post, here's only an excerpt. You can download the complete arduino-program here. If you are interested in the fritzing-file, leave a comment down below. The github-page: link

Thursday, July 7, 2016

Set RTC via WiFi

If you have WiFi-access, you can set your real-time-clock (RTC) with the help of the network time protocol (NTP) If there's no WiFi, using a radio-time-reciever might be a good option (see post about DCF77).

This post describes how you can set a DS3231-module via a WLAN-connection using the ESP8266-based "Wemos D1 R2"-board.

Wemos D1 R2 and DS3231-RTC-module

If you want to programm the Wemos-board with the Arduino IDE, you'll probably need to install the CH340 driver-package first (webpage with instructions, backup zip-file). After that, you add the ESP8266-library to your Arduino-IDE. For this you best follow the instruction on the github-page (backup zip-file). 
If you are going to use the DS3231-RTC-module you'll need to add the libraries in this zip-file as well (datasheets are attached).
And last, if not already installed, you'll need the time-library as well (Sketch → Include Library → Add .ZIP Library; backup zip-file).

wire-connections between the wemos and DS3231

Connect the wemos and the RTC as follows:

Wemos DS3231

The code for this project is rather long. Shown below are only the setup und loop-function. You can download the complete Arduino-project here.

Monday, December 21, 2015

Arduino radio controlled clock

In order to build a radio controlled clock with the arduino, you need a DCF reciever. In this post the receiver board from conrad is being used (Nr. 641138). For the display the Seven-Segment-LED-Backpack from Adafruit is utilized. - You can of course replace it with any display you like (an LCD for example). The circuit:

DCF + Arduino + Seven-Segment-Display

The pullup-resistor and the filtercap are necessary for the reciever board to work. They aren't needed for the 7-seg-display.

Circuit on breadboard

In order for the DCF-code to work you'll need to add three Arduino-libraries to the IDE (Sketch->Include Library-> Add .ZIP Library): DCF77, Time and Timezone.
I had trouble with compiling the examples included in the DCF77-library. Updating the Time-library resolved that problem (link).

In order to run the 7-seg-display you'll need the library from adafruit: github-link

The code:

Above code is set for the central european timezone. If you live somewhere else, in the UK for example, change the value of "LocalTime" in the fifth to last line to "UK.toLocal(DCFtime)". The same goes for other timezones (they get declared / are listed at the beginning of the code).

It takes around two minutes for the clock to get the current time. You can follow the process by opening the Serial Monitor of the Arduino IDE.

Saturday, May 16, 2015

Arduino Ethernet and Weathershield

A combination of the weathershield from sparkfun and the Ethernet-Arduino:

Ethernet-Arduino and the Weathershield
What the webpage looks like:

type the IP-adress directly into the url-bar of your browser

The code:

Wednesday, February 18, 2015

Minimalistic Arduino

In order to build a minimalistic Arduino, you need:
  • one 10kOhm resistor
  • two 22pF capacitors
  • one 100nF capacitor
  • one 16.000Mhz quartz oscillator
  • the ATMEGA 328P-chip (best with preinstalled bootloader)
  • a 5V Voltage-supply and some wiring
  • something for programming the chip (existing Arduino-Board or a USB-FTDI-Serial converter)
  • one LED and a 150 Ohm resistor (two of both if you want one for the voltage supply as well)
  • switch (Reset switch)
  • USB-FTDI-Serialchip / Arduinoboard
the basic schematic:
minimalistic Ardunio schematic (with optional reset-switch)
If you like the default LED on PIN 13 on the original Arduinoboard, connect first the LED to Pin 19  (right after AVCC), then the 150 Ohm resistor to the LED and the other end to ground.

If you want to supply your project with for example 9V from a battery you can build a simple voltageregulator like this (not suited for AC-Input!):

simple DC-Voltageregulator
all you need is a LM7805 and two 10uF capacitors. If you want, you can connect a LED with resistor to the 5V output (in order to see if the Atmega is under power).

If you are using a USB-FTDI-Serialchip (UFSC) connect the DTR/RST-PIN to the RESET-Pin of the Atmega via a 100nF capacitor. RX of the UFSC goes to the TX of the Atmega and the TX of the UFSC goes to the RX-Pin of the Atmega.

Sunday, February 8, 2015

Arduino & EasyDriver & Steppermotor

If you'd like to run a steppermotor with your Arduino, you're going to need a EasyDriver. This chip allows you to connect a variety of different steppermotors and supply them with their needed voltage (in most cases 12 V). Most common steppermotors will have four wires comming out of them which connect as follows:

Wiring of the EasyDriver, the Arduino and the steppermotor (LED is optional)

If you have a motor with six wires comming out of it, try connecting the two outer and the two inner wires to the chip.

The following Arduinocode has been modified so that you can connect up to three EasyDriver-chips. If you like you can connect three LEDs to Pins 11, 12 and 13 in order to see which motor is supposed to be running (don't forget to use appropriate resistors).

The EasyDriver has a few more connectors you can use:

Most important are ENABLE and SLP (Sleep). You can connect each of them to a seperate Arduino PIN and use the digitalWrite(PIN, HIGH) command to activate them. The difference between these two:
  • ENABLE set to HIGH will stop the powersupply to the steppermotor (you will be able to turn the motor shaft by hand), the IC is still under power.
  • SLP set to LOW will stop the powersupply of the motor and will put the IC into a hibernate-mode. Waking the IC up again can take some time (a few ms)