Tuesday, March 21, 2017

Istruzioni per il corso "Workshop: Robot quadrupede con Arduino"

Guida per WINDOWS

1) Scaricare Arduino IDE:
 dalla pagina https://www.arduino.cc/en/main/software, cliccate sulla scritta "Windows installer" e nella pagina seguente cliccate sulla scritta "just download". Installate il programma facendo doppio click nel file appena scaricato


2) Scaricare i driver da http://www.arduined.eu/files/CH341SER.zip
    Cliccare con il tasto destro nel file appena scaricato e dal menu a tendina scegliere estrai tutto.
    All'interno della cartella appena estratta troverete le due cartelle seguenti:
   Aprite la cartella CH341SER e fate doppio click sul file SETUP che troverete all'interno, si aprirà questa mascherina
Cliccare sul pulsante INSTALL

3) Aspettate che manchi una settimana al corso prima di eseguire questo punto, perchè il programma scaricato durerà 30 giorni.

Scaricate il free trial del programma FUSION 360 dal link http://www.autodesk.com/products/fusion-360/free-trial cliccando sul tasto arancione "DOWNLOAD FREE TRIAL" e successivamente inserite la vostra mail e scaricate il programma.
Fate partire l'installazione ed una volta installato nella schermata seguente

Cliccate su "CREATE ACCOUNT"

Compilate la pagina sucessiva con i vostri dati, spuntate la casella "I agree ..." e cliccate su "CREATE ACCOUNT". La vostra mail e password serviranno per accedere al programma, scrivetele da qualche parte per non dimenticarle.

Finito :)





Guida per IOS

1) Scaricare Arduino IDE:
 dalla pagina https://www.arduino.cc/en/main/software cliccate sulla scritta "MAC OS X" e nella pagina seguente cliccate sulla scritta "just download". Installate il programma facendo doppio click nel file appena scaricato

2) I driver li installiamo direttamente durante il corso

3) Aspettate che manchi una settimana al corso prima di eseguire questo punto, perchè il programma scaricato durerà 30 giorni.

 Scaricate il free trial del programma FUSION 360 dal link http://www.autodesk.com/products/fusion-360/free-trial cliccando sul tasto arancione "DOWNLOAD FREE TRIAL" e successivamente inserite la vostra mail e scaricate il programma.
Fate partire l'installazione ed una volta installato nella schermata seguente

Cliccate su "CREATE ACCOUNT"

Compilate la pagina sucessiva con i vostri dati, spuntate la casella "I agree ..." e cliccate su "CREATE ACCOUNT". La vostra mail e password serviranno per accedere al programma, scrivetele da qualche parte per non dimenticarle.

Finito :)

Monday, March 20, 2017

Istruzioni per il corso "Workshop: Braccio robotico con Arduino"

Guida per WINDOWS

1) Scaricare Arduino IDE:
 dalla pagina https://www.arduino.cc/en/main/software, cliccate sulla scritta "Windows installer" e nella pagina seguente cliccate sulla scritta "just download". Installate il programma facendo doppio click nel file appena scaricato


2) Scaricare S4A dal link http://vps34736.ovh.net/S4A/S4A16.zip 
    Cliccare con il tasto destro nel file appena scaricato e dal menu a tendina scegliere estrai tutto.
    Installare il programma facendo doppio click nel file S4A16 che troverete all'interno della cartella      appena estratta

3) Scaricare i driver da http://www.arduined.eu/files/CH341SER.zip
    Cliccare con il tasto destro nel file appena scaricato e dal menu a tendina scegliere estrai tutto.
    All'interno della cartella appena estratta troverete le due cartelle seguenti:
   Aprite la cartella CH341SER e fate doppio click sul file SETUP che troverete all'interno, si aprirà questa mascherina
Cliccare sul pulsante INSTALL

Finito :)





Guida per IOS

1) Scaricare Arduino IDE:
 dalla pagina https://www.arduino.cc/en/main/software cliccate sulla scritta "MAC OS X" e nella pagina seguente cliccate sulla scritta "just download". Installate il programma facendo doppio click nel file appena scaricato

2) Scaricare e installare S4A http://vps34736.ovh.net/S4A/S4A16.dmg

3) I driver li installiamo direttamente durante il corso

Monday, February 16, 2015

Custom font in Eagle Cad gerber file

If you want to export your Eagle Cad design to gerber file all the text is automatically converted to VECTOR font.
Normally that's ok because the text is only needed to mount the pcb, once it is done it will be hidden at the user, in my case (the smarzlogio) the text are visible to the user and the vector font is orrible.
After serching in the web I didn't find any easy and quick solution, and after some time on the program I found a way to do is, and it's very simple.


As you can see the font I'm using is the PROPORTIONAL

To preserve this fon on the gerber all you need to do is:

1)  Make visible only the text layer you need 

2) File -> Export -> Immage 
Now select MONOCHROME and use the resolution you want (2400 dpi is the highest resolution disponible)
Click BROWSE and save the immage as BMP.




3)File -> Import -> Bitmap, open you immage and select the black color
Now you have to switch to dpi mode (insert the dpi you used before) and chose the layer where the text will be placed, press ok and the script will run, when it ends press run script.



4) Now you have only to move the text in the place you want.



5) When exporting gerber, select the layer where you placed the immage as the silk layer.

 
     


Sunday, July 7, 2013

Cnc milled iphone 5

A friend of mine ask me to shape some wood into an iphone 5 because he wanted sew some covers made of felt and he needed a model for the measures.
So I modelled the iphone and milled it into a scrap from a old door.

This is what came out


After giving him the model, I milled an other for me, so now I own an iphone 5 too ;)

Thursday, April 4, 2013

Weekend project - CNC wooden rubik cube-

In these last few month I had to travel by train 3 hours a day, so I've learnt how to solve rubik cube and I bought one designed for speed cubing.
When the cube arrived I found out, to my great joy,  it wasn't already mounted!!
I spent some time to build it, the speed-cubing cube are very different internally from the "normal" rubik cube, they don't have sharp edge as the other version, they have some strange 3D curves instead

dayan cube

Since this model is too much complex to mill with a normal 3-axis milling machine, i decided to try milling the normal and easier cube

normal cube

This will be the project pipeline:

-Create the 3D model
-Find how to mill it (it can't be milled in a single step)
-Create the CNC file
-Find how to put all the pieces together


3D MODEL done

central piece (need 6 of them)

testing in the 3D model if the piece match

some piece together





First milling test


This lateral piece was made milling in two sides, top and bottom face.
The results are good, not amazing, but good, you can see a light division line. Next time I'll use a longer drill and do a top-to-bottom first milling step to remove this problem.
Milling this was relatively simple, the hard part will be mill the angle pieces, because they can't be made in two step, they need three.
I'm planning to build an array of square holes from a thick wood piece where to fix the cube pieces and do the second and third milling phases.

First test done, milled the first part end then the hole where the piece will be fixed.
After a coordinate problem (as you can see in the picture) i milled the two remaining sides.
The result is not so good, so next time instead of drill a hole and then fix the part there I'll build a sort of clap where the piece can be hold


I will update you on how things are going as soon as possible :)


Friday, March 15, 2013

Binary clock



Make a binary clock is the dream of all NERD on the world right? (mmm.. or maybe build a lightsaber :) ).
I got this idea while I was attending my last year of school, and i decide to design and build a binary wristwatch.

I was studing pic's at the moment so, for the brain I chose a everyone-known PIC16F628.



For the time display
I thought of using 4 led's for the hours and 6 led for the minutes following this scheme:
You can get the hours by adding the value of ON green leds, and the same process for the minutes with red leds.


HOW TO MISURE THE CORRECT TIME? 

To keep the correct timing i used Timer1 operating in asynchronous counter mode, the idea is this:
to save battery life the pic will be on sleep-mode when the time is not displayed, and the led will be ON only for a few second after one of the 2 buttons is being pressed. While in sleep-mode the pic shut-down almost all of his feature, but the TMR1 counter mode still stays on, so you can count the time while the pic is sleeping.
When the TMR1 16-bit-register overflow, a interrupt signal wake up the pic, in this case the second's are updated and the pic returns at bed.
To use TMR1 as external counter, you have to give him something to count, this is made by adding a 32.768 Hz quarz oscillator between pins RB7 and RB6.
The pic will be running with internal oscillator clock at 32 khz instead of 4 Mhz to save additional current.


HOW TO DISPLAY TIME?

The time is displayed when one of the 2 buttons is pressed. The question now is: how can the pic read the button if it's on sleep-mode? Well, for that I used interrupt-on-change feature for RB4 and RB5, when the state of these pins change the pic is waked up.
When a button is pressed, TMR0 is also load with a value and TMR0 interrupt is enabled, this is used to measure the time the leds will be on, when TMR0 overflow, all the leds are tuned OFF and the pic return in sleep-mode.

SUMMARIZING ALL THE LOGIC BEHIND THIS CLOCK

-start of the program (initialization)
-pic go on sleep

 IF TMR1 go on overflow
   -wake up pic
   -update time
   -return on sleep

IF PORB-interrupt
   -wake the pic
   -turn on leds displaying time
   -wait for a while (with TMR0 overflow)
   -turn off all leds
   -return on sleep


HOW TO SET TIME?

Well, in this case i have to updade the program, now you can set the time only the first time you boot the clock.


SCHEMATICS


(the strip is for pic-kit programmer)
(there is one more led used for MODE-led)

SOME PHOTOS






the body is made of PVC, the battery I'm using is a CR2032, the battery compartment is milled in the body by a CNC machine.
The strap is simply glued to the bottom of the body, in 1mm-deep recess.

here is the asm code


list p=16F628
include <P16F628.INC>

;TITLE "Smazlogio v1.7"
;AUTHOR Santelelle


 ;min 1 porta.2
 ;min 2 porta.3
 ;min 4 porta.4
 ;min 8 portb.0
 ;min 16 portb.1
 ;min 32 portb.3

 ;portb minutes b'00001011'
 ;porta minutes b'00011100'

 ;ore 1 porta.1
 ;ore 2 porta.0
 ;ore 4 porta.7
 ;ore 8 porta.6

 ;portb hours b'00000000'
 ;porta hours b'11000011'

 ;pulsante sinistro  portb.4
 ;pulsante destro    portb.5

 ;led MODE portb.3

SEC   EQU  0x20
MIN  EQU   0x21
ORE EQU   0x22
W_TEMP EQU 0x23
S_TEMP EQU 0x24
TMR1_INTERRUPT_FLAG EQU 0x25
LED_ON EQU 0x26
CONTATORE_PULSANTE1 EQU 0x27
PROGRAM EQU 0x28
DELAY_COUNTER EQU 0x29
TMR0_INTERRUPT_FLAG EQU 0x2A
CONTATORE EQU 0x2B
PORTB_INTERRUPT_FLAG EQU 0x2C
CONTATORE_PULSANTE2 EQU 0x2D

  ORG   0000H
    goto  START
;

  ORG   0004H            ;interrupt occurred
      BTFSC PIR1, TMR1IF   ;Timer1 overflowed?
         call T1_OVERFL    ;YES, Service the Timer1 Overflow Interrupt
      BTFSC INTCON,RBIF        ;portb changed?
         call PORTB_INTERRUPT  ;goto portb_interrupt routine
      BTFSC INTCON,TMR0IF        ;portb changed?
         call TMR0_INTERRUPT  ;goto portb_interrupt routine
      retfie
;
; Should NEVER get here
;
  ERROR1 ; NO, Unknown Interrupt Source
  BSF PORTA , 4 ; Toggle a port pin to indicate error
  BCF PORTA , 4
  GOTO ERROR1

START

;inizializzazione variabili
      bcf INTCON,GIE            ;global interrupt enable

      clrf SEC
      clrf MIN
      clrf ORE
      clrf TMR1_INTERRUPT_FLAG
      clrf LED_ON
      clrf PROGRAM
      clrf TMR0_INTERRUPT_FLAG
      clrf CONTATORE
      clrf PORTB_INTERRUPT_FLAG
      clrf DELAY_COUNTER

;fine inizializzazione variabili

;settaggio registri
      bcf   STATUS,RP0   ; select bank0
      clrf  PORTA
      bsf   STATUS,RP0   ; select bank1
      movlw b'00100000'
      movwf TRISA
   
      bcf  STATUS,RP0  ; select bank0
      clrf PORTB
      bsf  STATUS,RP0  ; select bank1
      movlw b'11110000'
      movwf TRISB
   

      bsf  STATUS,RP0  ; select bank1
      movlw b'00000111'
      movwf OPTION_REG

      movlw b'00000001'  ; enable TMR1 overflow
      movwf PIE1

      movlw b'00000011'
      movwf PCON

      bcf  STATUS,RP0  ; select bank0

      movlw b'00000111'
      movwf CMCON

      clrf PORTA      ; accende tutti i led
      clrf PORTB      ; accende tutti i led
;fine settaggio registri


ASPETTA_PULS                     ;until the button isn't pushed the program doesn't start
     btfsc PORTB,4               ;
         goto ASPETTA_PULS       ;

      movlw b'11111111'          ;turn off all portb
      movwf PORTA                ;
      movlw b'11111111'          ;turn off all portb
      movwf PORTB                ;

      ;movlw b'00001111'          ;set timer1 as external asyncronous counter
      movlw b'00111111'          ;16 seconds
      movwf T1CON                ;

      goto PROGRAMMING_MODE
   


m_cicle                          ;main cicle

      btfsc TMR1_INTERRUPT_FLAG,0     ;if an interrupt occurred
         call AGGIORNA_ORA       ;upgrade time
 
      btfss TMR0_INTERRUPT_FLAG,0
         goto NO_TMR0_INTERRUPT
      bcf TMR0_INTERRUPT_FLAG,0
      clrf CONTATORE
      bcf LED_ON,0
      clrf CONTATORE
NO_TMR0_INTERRUPT


      btfss PORTB_INTERRUPT_FLAG,0
         goto NO_PORTB_INTERRUPT
      bcf PORTB_INTERRUPT_FLAG,0

      btfss PORTB,4
         incf CONTATORE

 bsf LED_ON,0
      clrf TMR0
      bcf INTCON,T0IF           ;clear the interrupt TMR0 flag
      bsf INTCON,T0IE           ;activate timer0 interrupt
NO_PORTB_INTERRUPT


      movlw b'00001000'
      subwf CONTATORE,0
      btfsc STATUS,Z
         goto PROGRAMMING_MODE

      btfss LED_ON,0             ;se è attivo il flag accende i led
         goto NO_OUTPUT
      call OUTPUT_MINUTI
      call OUTPUT_ORE
      goto  m_cicle

NO_OUTPUT
     
       call ALL_LED_OFF

       sleep;

goto   m_cicle             ;end main cicle


PROGRAMMING_MODE

     bcf INTCON,GIE        ;disables interrupt

     bcf INTCON,RBIF
     bcf INTCON,TMR0IF
     bcf PIR1, TMR1IF

     call ALL_LED_OFF
     bcf PORTB,2         ;turn on blue led
     clrf MIN
     clrf ORE
     call DELAY

     clrf CONTATORE_PULSANTE1
     clrf CONTATORE_PULSANTE2
     clrf CONTATORE

PROG_MINUTI
;
     btfss PORTB,4
        incf CONTATORE_PULSANTE1
     btfsc PORTB,4
        clrf CONTATORE_PULSANTE1
     movlw b'00001110'
     subwf CONTATORE_PULSANTE1,w
     btfsc STATUS,Z
        goto RELASE_CYCLE1R_
;
     btfss PORTB,5
        incf CONTATORE_PULSANTE2
     btfsc PORTB,5
        clrf CONTATORE_PULSANTE2
     movlw b'00001110'
     subwf CONTATORE_PULSANTE2,w
     btfsc STATUS,Z
        goto RELASE_CYCLE1L_

     goto PROG_MINUTI
;
RELASE_CYCLE1R_
    incf MIN
    call OUTPUT_MINUTI
    clrf CONTATORE_PULSANTE1
    clrf CONTATORE_PULSANTE2
RELASE_CYCLE1R
    btfss PORTB,4
       clrf CONTATORE_PULSANTE1
    btfsc PORTB,4
       incf CONTATORE_PULSANTE1
    movlw b'00001110'
    subwf CONTATORE_PULSANTE1,w
    btfsc STATUS,Z
        goto PROG_MINUTI
    goto RELASE_CYCLE1R
;
 
RELASE_CYCLE1L_
    clrf CONTATORE_PULSANTE1
    clrf CONTATORE_PULSANTE2
RELASE_CYCLE1L
    btfss PORTB,5
       clrf CONTATORE_PULSANTE2
    btfsc PORTB,5
       incf CONTATORE_PULSANTE2
    movlw b'00001110'
    subwf CONTATORE_PULSANTE2,w
    btfsc STATUS,Z
        goto PROG_HOUR_
    goto RELASE_CYCLE1L
;;
PROG_HOUR_
    clrf CONTATORE_PULSANTE1
    clrf CONTATORE_PULSANTE2
PROG_HOUR
     btfss PORTB,4
        incf CONTATORE_PULSANTE1
     btfsc PORTB,4
        clrf CONTATORE_PULSANTE1
     movlw b'00001110'
     subwf CONTATORE_PULSANTE1,w
     btfsc STATUS,Z
        goto RELASE_CYCLE2R_

     btfss PORTB,5
        incf CONTATORE_PULSANTE2
     btfsc PORTB,5
        clrf CONTATORE_PULSANTE2
    movlw b'00001110'
    subwf CONTATORE_PULSANTE2,w
     btfsc STATUS,Z
        goto RELASE_CYCLE2L_
     goto PROG_HOUR

RELASE_CYCLE2R_
    incf ORE
     call OUTPUT_ORE
    clrf CONTATORE_PULSANTE1
    clrf CONTATORE_PULSANTE2
RELASE_CYCLE2R
    btfss PORTB,4
       clrf CONTATORE_PULSANTE1
    btfsc PORTB,4
       incf CONTATORE_PULSANTE1
    movlw b'00001110'
    subwf CONTATORE_PULSANTE1,w
    btfsc STATUS,Z
        goto PROG_HOUR
    goto RELASE_CYCLE2R

 
RELASE_CYCLE2L_
    clrf CONTATORE_PULSANTE1
    clrf CONTATORE_PULSANTE2
RELASE_CYCLE2L
    btfss PORTB,5
       clrf CONTATORE_PULSANTE2
    btfsc PORTB,5
       incf CONTATORE_PULSANTE2
    movlw b'00001110'
    subwf CONTATORE_PULSANTE2,w
    btfsc STATUS,Z
        goto END_PROGRAMMING
    goto RELASE_CYCLE2L

END_PROGRAMMING

     call ALL_LED_OFF
     bcf T1CON,T1OSCEN
     clrf TMR1H
     clrf TMR1L
     bsf T1CON,T1OSCEN

     bsf INTCON,RBIE           ;portb interrupt on change enable
     bsf INTCON,PEIE           ;peripheral interrupt enable
     bsf INTCON,GIE            ;global interrupt enable

goto m_cicle


ALL_LED_OFF
   movlw b'11111111'
   movwf PORTA
   movwf PORTB
return


OUTPUT_MINUTI

      movlw b'00001011'
      iorwf PORTB,f
      movlw b'00011100'
      iorwf PORTA,f

      btfsc MIN,0
         bcf PORTA,2
      btfsc MIN,1
         bcf PORTA,3
      btfsc MIN,2
         bcf PORTA,4
      btfsc MIN,3
         bcf PORTB,0
      btfsc MIN,4
         bcf PORTB,1
      btfsc MIN,5
         bcf PORTB,3
return

OUTPUT_ORE

      movlw b'11000011'
      iorwf PORTA,f

      btfsc ORE,0
         bcf PORTA,1
      btfsc ORE,1
         bcf PORTA,0
      btfsc ORE,2
         bcf PORTA,7
      btfsc ORE,3
         bcf PORTA,6
   
return


AGGIORNA_ORA

      bcf TMR1_INTERRUPT_FLAG,0        ;clear interrupt TMR1 flag

      ;incf SEC                    ;inc seconds
      ;incf SEC                    ;inc seconds

      movlw b'00010000'
      addwf SEC,f

      movlw b'00111100'           ;are seconds >= 60?
      subwf SEC,W                 ;
      btfsc STATUS,C              ;
    call INC_MIN             ; call the function that increment minutes

      movlw b'00111100'           ;are minutes >= 60?
      subwf MIN,W                 ;
      btfsc STATUS,Z              ;
    call INC_ORE             ; call the function that increment hours
      movlw b'11111111'
   
return                           ;return to main

INC_MIN                           ;increment minutes
      incf MIN,f
      movlw b'00111100'           ;seconds = seconds - 60                
      subwf SEC , f               ;
return

INC_ORE                           ;increment minutes
      incf ORE                    ;inc ore
      movlw b'00111100'           ;minutes = minutes - 60                
      subwf MIN , f               ;

      movlw b'00001100'           ;are hours = 12?
      subwf ORE,W                 ;
      btfsc STATUS,Z              ;
    clrf ORE                 ; if hours=12 then hours=0
return


TMR0_INTERRUPT
      bsf TMR0_INTERRUPT_FLAG,0
      bcf INTCON,T0IF
      bcf INTCON,T0IE
      bsf INTCON,7        ;enable interrupt
return

PORTB_INTERRUPT
      movf PORTB,w
      bcf INTCON,RBIF

      btfss PORTB,4
         goto SET_PORTB_FLAG
      btfss PORTB,5
         goto SET_PORTB_FLAG
      bsf INTCON,7        ;enable interrupt
      return

SET_PORTB_FLAG
      bsf PORTB_INTERRUPT_FLAG,0
      bsf INTCON,7        ;enable interrupt
return

T1_OVERFL                        ;TMR1 overflowed
      bsf TMR1_INTERRUPT_FLAG,0
      bcf PIR1, TMR1IF ; Clear Timer1 Interrupt Flag
      bsf INTCON,7        ;enable interrupt
return

DELAY
     clrf DELAY_COUNTER
DELAY_CYCLE
     incf DELAY_COUNTER
     btfss STATUS,Z
        goto DELAY_CYCLE
return



end


Edit: I'm really sorry, I forgot the configuration bits.