venerdì 5 gennaio 2018

The DrawingBot







In this post I describe the making of a small robot called DrawingBot which draws some simple shapes or lines on a sheet of paper using a simple felt tip pen.





For the impatient one below the video of the making and the video of drawing executed by DrawingBot.

















Project


The project is intended for everyone that want to realize a small robot from scratch and the ones with the main purpose to learn and experiment.

Once realized the DrawingBot it is possible to draw some simple drawing which are not really accurate. However the main goal is not to draw but to build and understand how the DrawingBot works from mechanical, electrical and software point of view.


The project is made by the major elements:
  • the  STL files for the 3D printing of the chassis 






  • the Arduino code (sketch) to control the robot
  • a simple python app which allow the user to pro grammatically generate drawings on screen  and that automatically generates the DrawingBot commands

All the files are available on my github [here]

Making

Let's now see the steps to build and make the DrawingBot


1- Printing of the  DrawingBot


Download the STL file for each component from my  github [here] and print them with your 3D printer


2- DrawingBot Assembling- Mechanical part


In the initial video I have assembled the DrawingBot from scratch hence all the steps are available in the video.

Below the Bill of Material of the  DrawingBot containing all the necessary components







The assembling of the mechanical parts is quite simple and can be complete with a normal screw driver and just few bolt and nuts.


3- DrawingBot Assembling- Electrical part

Once all the 3D printed components are assembled it is time for the electronics which is based on standard and inexpensive components: 1x Arduino Uno, 2x stepper and  1x Servo.

The assembling of the circuit is very simple and it is done through the use of few rainbow DuPont wires, hence using a color code. For this reason this circuit can be made by everyone including kids and beginners.















In order to achieve a quite clean and ordered cabling I have realized a simple connection board by using a small strip board.
















Software forArduino

The DrawingBot's software is avaiable on my github [here].


There are few parameters that can be tweaked based on your specific needs:

  • PEN_DOWN:  rotation angle of the servo when the pen is down (drawing)
  • PEN_UP: rotation angle of the servo when the pen is up (moving)
  • wheel_dia: wheel's diameter in mm
  • wheel_dia_correction: correction factor to make the DrawingBot more accurate
  • wheel_base: width wheel-to-wheel in mm

Drawing Software

The drawingbot.py file contains a simple app in python that allow:

  • create and show on screen a programmatic drawing
  • automatically generate the commands for the DrawingBot

The programmatic drawing should be included in the following method: def drawing()





This generates a drawing on the screen





and in the console the DrawingBot's command will be printed




Now in the  drawingbot.ino file, after the below line just add the commands generated in the previous step

/* Insert here the drawing commands */


Compile and upload your sketch and after 5 seconds the DrawingBot will automatically start to execute the drawing

Happy DrawingBot-ting!!!! :)













DrawingBot







In questo post descrivo la realizzazione di un piccolo robot chiamato DrawingBot che realizza dei semplici disegni su un foglio di carta usando un comune pennarello.




Per chi e' impaziente ecco qui il video della realizzazione del Drawing Bot ed il video delle'esecuzione di un semplice disegno

















Progetto


Il progetto e' destinato a chiunque voglia realizzare un piccolo robot partendo da zero e che abbia come scopo principale l'apprendere ed il capire.
Una volta realizzato il DrawingBot si possono realizzare dei semplici disegni che risultano abbastanza imprecisi. Come detto lo scopo finale e' la realizzazione e non l'uso del DrawingBot.


Il progetto e' composto da 3 elementi principali:

  • i file STL per la stampa in 3D dello chassis






  • il codice per Arduino per il controllo del Robot
  • un file in python che permette di disegnare a video e generare automaticamente i comandi da fornire a DrawingBot per effettuare il disegno 

Tutti i file sono disponibili sul mio github [qui]

Realizzazione Pratica

Vediamo i passi per la realizzazione pratica del DrawingBot


1- Stampa del DrawingBot


Scaricare i file STL di tutti gli elementi del DrawingBot dal mio github [qui] e stamparli con una stampante 3D.


2- Assemblaggio del DrawingBot - Meccanica


Nel video iniziale ho assemblato il DrawingBot partendo da zero, quindi potete vedere tutti i passi.

Riporto qui la Bill of Material del DrawingBot con tutti i componenti necessari







In ogni caso l'assemblaggio della parte meccanica e' semplicissimo in quanto richiede solo un cacciavite e alcune viti e bulloni.


3- Assemblaggio del DrawingBot - Elettrico

Una volta assemblato i pezzi stampati del DrawingBot bisogna montare la parte elettrica che e' basata su Arduino Uno, 2x motori passo-passo ed 1x Servo.

L'assemblaggio del circuito elettrico utilizza una serie di rainbow cable e quindi si basa su un codice colore ed e' quindi di facilissima realizzazione adatta anche ai meno esperti.














Per ottenere un cablaggio pulito ho realizzato una semplicissima basetta che mi permette di connettere i vari cavi in modo chiaro e pulito
















Software per Arduino

Il software per il DrawingBot e' disponibile sul mio github [qui].


Ci sono pochissimi parametri che potete regolare in base alle vostre esigenze:

  • PEN_DOWN:  angolo di rotazione del servo quando la penna e' giu'
  • PEN_UP: angolo di rotazione del servo quando la penna e' su'
  • wheel_dia: diametro in millimetri della ruota
  • wheel_dia_correction: fattore di correzione per rendere il DrawingBot piu' preciso
  • wheel_base: larghezza da ruota a ruota in millimetri (lato esterno della ruota)

Software per Disegnare

Il file drawingbot.py contiene un semplice programma in python che permette di:

  • visualizzare su schermo un disegno algoritmico
  • generare automaticamente i comandi per il DrawingBot

Il disegno va realizzato nel metodo: def drawing()





Questo genera un disegno sullo schermo




e nella console vengono stampati i comandi da fornire a DrawingBot




Ora nel file drawingbot.ino aggiungete/sostituite i comandi generati dopo la seguente linea

/* Insert here the drawing commands */


Compilate e caricate lo Sketch su Arduino e dopo 5 secondi il DrawingBot iniziera' a realizzare il disegno autonomamente

Buon divertimento!!!! :)













domenica 19 novembre 2017

Christmas Lights with WS2811 strip and RemoteXY app










Few days ago a friend of mine described me a project he was doing with his son and a led strip and Arduino.

As always small projects with lights or sounds are very interesting for young kids as they stimulate their fantasy and capture their attention.

Based on that I have decided to buy the same  RGB Led Strip WS2811 12mm  5V  from Amazon:






Led Strip

The led strip is made of 50 led RGB WS2811 which are individually addressable. The strip is solid and built with good quality and made for external use.

As Christmas Holidays period is approaching I think this is the perfect project to develop with my daughter: Lights for a Christmas tree which is programmable from a mobile app.



Mobile App

The mobile app is based on RemoteXY  service and it is quite simple.  It provides a vertical switch with 10 different button options.

Each button is associated to a different light effect implemented on the strip.

The full RemoteXY project is available here

In addition I have shared the entire source code on my GitHub 
















Circuit

The figure below shows the connection of the different components






As you can see the led strip has been represented by a single WS2811 led.
In place of the battery pack I have used a mobile phone charge (5V 1 A)

Note:
if you have a more powerful charger (like 2A) please use it as it will get to lower temperature of operations 


It is very important to note that the negative (-) wire from the charger is connected to the GND pin of nodeMCU in order to allow the proper behavior of the led strip.

The data line of the strip is connected on pin D4 by a 470 Ohm resistor.

I have also added a 1000 uF capacitor between the power wires of the strip. 
The capacitor is not strictly mandatory but highly suggested in order to avoid possible tension spike at the input of the strip.


Implementation

Below some picture of my implementation







For the sake of simplicity I have mounted the nodeMCU on a breadboard. A strip board would be good as well.










Above the detail of the connection of the data line pin of the strip.






Here some details of the connection between the charger (black wires on the left) and the strip wires (white and red on right). As you can see the cap is plug and the blue wire is connected between the nodeMCU GND pin and the negative (-) power wire.





Test

Below you can see the led strip on the wall of my studio ready for testing.
According to Italian tradition I cannot have the xmas tree before December 8th :) so I need to wait few more weeks to install the led strip on the tree :)







Here the video showing all the 10 different lighting effect implemented in this project.






Obviously you can implement your own lighting effects and the limit is only your fantasy.
If you want share your effects so it can help other people.