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.


Luci di Natale con striscia led WS2811 e App Mobile RemoteXY










Alcuni giorni fa' un mio carissimo amico mi ha parlato di un gioco carino che stava facendo con suo figlio con una striscia led programmabile ed Arduino.

Come sempre i progetti con luci e suoni sono adattissimi ai piu' piccoli in quanto catturano la loro attenzione e stimolano la loro fantasia. 

Allora ho deciso anche io di comprare la stessa Striscia RGB Led WS2811 12mm a 5V da Amazon:






Striscia Led

La striscia led e' composta da 50 led RGB WS2811 e quindi indirizzabili singolarmente. La striscia e' realizzata bene ed ogni Led e' protetto per uso esterno.

In questo periodo pre Natalizio e' il progetto perfetto da fare con mia figlia: realizzare delle luci di Natale per il nostro albero che siano programmabili tramite un'app mobile.




App Mobile

L'app mobile e' realizzata con RemoteXY  ed e' molto semplice.  Fornisce un selettore verticale con 10 possibili scelte.
Ogni scelta corrisponde ad un effetto luminoso differente.

Il progetto RemoteXY e' disponibile qui

Inoltre ho condiviso tutto il codice disponibile sul mio GitHub 
















Circuito

Nella figura sotto lo schema delle connessioni





Come potete vedere la striscia led e' rappresentata da un solo led WS2811.
Per il pacco batterie io ho utilizzato un caricatore per cellulare da 5V 1A.

Nota:
Se avete a disposizione un caricatore che puo' erogare piu' corrente utilizzatelo in modo da evitare possibili surriscaldamenti.


E' importante notare come il meno (-) dell'alimentazione vada collegato con il pin GND del nodeMCU in modo da far funzionare correttamente la striscia.

La linea dati della striscia e' collegata al pin D4 tramite un resistore da 470 Ohm. 

Ho anche aggiunto un condensatore da 1000 uF tra i fili di alimentazione della striscia. 
Il condensatore non e' strettamente obbligatorio ma consigliato per evitare sbalzi di tensione ai capi della striscia.


Realizzazione

Sotto le foto della mia realizzazione 







Per praticita' ho montato il nodeMCU su una breadboard. Una scheda millefori andrebbe bene ugualmente.












Sopra il dettaglio della connessione del pin dati della striscia led.





Sopra il dettaglio dei collegamenti tra i fili del caricatore per cellulare (neri a sinistra) e i fili (bianco e rosso) di alimentazione della striscia. Come potete vedere e' presente il condensatore e il filo blu che proviene dal pin GND del nodeMCU.

Io ho utilizzato un mammut ma altre soluzioni sono possibili in caso ne siate sprovvisti.








Test

Sotto potete vedere le luci appese alla parete del mio studio pronte per essere testate.
Ovviamente dopo 8 Dicembre le montero' sull'albero ma per il momento non e' possibile. :)






Qui il video che dimostra i 10 effetti luminosi implementati in questo progetto.





Chiaramente potete sbizzarrirvi con la fantasia ed implementare altri effetti luminosi. 
Se lo fate condivideteli qui sul blog cosi' ne potranno beneficiare tutti




giovedì 16 novembre 2017

Remote Control a 2 Channel Relay board with RemoteXY











A recurring question on some Arduino and ESP groups on Facebook goes like: "how to remotely control a relay?"

In this post I show a simple and quick way to remotely control a 2 Relay module through a mobile app using the RemoteXY service.

Pre-requisite to this post is a previous I have written : "Remote Control NodeMCU with RemoteXY" in which I introduce the development of mobile apps to control nodeMCU projects.


The Circuit





As shown in the above figure, the 2 Channel Relay module has 4 pins:

  • GND
  • IN1
  • IN2
  • Vcc

Those pins need to be wired in the following way:

  • Module: GND --> nodeMCU:GND
  • Module: IN1 --> nodeMCU:D4
  • Module: IN2 --> nodeMCU:D5
  • Module: Vcc --> nodeMCU:Vin

Note:

Those wire connections assume that the nodeMCU is powered with 5V.
In such situation on the module Vin pin there will be 5V which is the right voltage to provide to the Relay module.

If you power you nodeMCU with a different voltage, please make sure you adapt the voltage available on Vin to be exactly 5V.



Graphic Interface






Build this simple graphic interface by using 3 labels and 2 switch in the RemoteXY editor.

The switch si should be named:
  • switch_1
  • switch_2

Now in the configuration panel, bottom right, let's configure each switch in a way that they connect to pin D4 and D5 on the nodeMCU














Configuration 

Let's configure RemoteXy in this way





Don't forget to specify your WiFi name and password






Source Code


Here the link  of the shared RemoteXY project. Once on RemoteXY you can download the source code to upload on your nodeMCU


Testing


Below a short video showing the behavior of the application











Controllo Remoto di un modulo Relay a 2 canali con RemoteXY











Una domanda ricorrente sui gruppi Arduino e ESP di Facebook e': "come controllo un rele' da remoto?"

In questo post faccio vedere un modo semplice e veloce per controllare un modulo a 2 Rele' tramite un applicazione mobile sfruttando un servizio chiamato RemoteXY.

Questo post si basa sui concetti descritti in un mio post precedente: "Controllo Remoto di NodeMCU con RemoteXY - Accensione Led" in cui ho introdotto lo sviluppo di una semplice app per controllo remoto di un nodeMCU.


Circuito Elettrico





Come si vede in figura il modulo Relay a 2 canali espone 4 pin


  • GND
  • IN1
  • IN2
  • Vcc

Questi pin vanno collegati nel seguente modo:

  • Modulo: GND --> nodeMCU:GND
  • Modulo: IN1 --> nodeMCU:D4
  • Modulo: IN2 --> nodeMCU:D5
  • Modulo: Vcc --> nodeMCU:Vin

Nota:

Questi collegamenti assumono che il nodeMCU sia alimentato a 5 V.
Cio' significa che sul pin Vin ci saranno 5V adatti ad alimentare il modulo Releay.

Se alimentate il vostro nodeMCU con una tensione differente assicuratevi di adattare la tensione in modo che sul pin Vcc del modulo Releay ci siano 5 V








Interfaccia Grafica





Realizzate questa semplice interfaccia grafica dall'editor di RemoteXY usando 3 label e 2 switch.

Gli switch si devono chiamare:
  • switch_1
  • switch_2

Ora nel pannello di configurazione in basso a destra, configurate ognuno degli switch in modo da collegarli ai pin D4 e D5 di nodeMCU














Configurazione

Configurate RemoteXY in questo modo




Non dimenticatevi di impostare il nome della vostra rete WiFi e la password di accesso.





Codice


Qui il link del progetto condiviso su RemoteXY da cui potete scaricare il codice da caricare sul vostro nodeMCU


Funzionamento


Qui un video che dimostra il funzionamento dell'applicazione