This is my new robot named "FDR" (Futurama Drum Robot)

Posted on 20/12/2009 by myblack60impala
Modified on: 13/09/2018
Introduction
This is an automatic import from our previous community platform. Some things can look imperfect.

If you are the original author, please access your User Control Panel and update it.

    3/27/10 I soldered up an 8 watt amplifier kit from kitsrus.com (picture below) to add onto the robot. I will be using PWM into the amp from an extra micro pin to make tones which will be played on the side speakers. This is the next step in adding another level of musical sound to this robot. Then once I figure out PWM rates to tone corrected music notes. I'll be adding another select case to my code, as well as additions to the counter loops. So that the random rhythm-timings will ...


This is my new robot named "FDR" (Futurama Drum Robot)

 

 

3/27/10

I soldered up an 8 watt amplifier kit from kitsrus.com (picture below) to add onto the robot.

I will be using PWM into the amp from an extra micro pin to make tones which will be played on the side speakers.

This is the next step in adding another level of musical sound to this robot. Then once I figure out PWM rates to tone corrected music notes. I'll be adding another select case to my code, as well as additions to the counter loops. So that the random rhythm-timings will play the tones in a fashion that relates these musically together with the drum beats. I think I'll also have to add additional filtering to this circuit for noise, from all the other devices on this robot.

I'm also considering changing one of the drums to a cymbal. As well as exploring other sound options I can add on.

As always, I will be adding more features as time allows.


 

This is my version of the ever popular drum robot. Its called "FDR" (Futurama Drum Robot) named for the laser cnc job of the characters in both sides of its tankbot chassis.

  • The brain is a wrighthobbies mega32 board.
  • The 4 drum motors are the very popular solarbotics pager gear motors.
  • The motorcontrollers are 3 - 298 controllers. One from Solarbotics, the other 2 are scratch made.
  • The sensors are: 1 Sharp Ranging for object detection, 1 ZXSound for measuring background noises.
  • The power is supplied by a Futurlec powersupply and 9v in AA's, a regulation pack of 4.8v in AA's, and a 9v for the microcontroller.

This robot works by scanning around for objects, then driving either forward/turning, then when its ready it plays some completely random music. I'm still programming and adding functions at this point, but it will have more routines, and will do a better job of staying in rhythm, etc. But overall you can see the gist of it....

Oh and I know it resembles a river boat, that wasn't intentional, but it adds a certain level of "cool".

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 Thanks for looking!!!

 

CODE:

$regfile = "m32def.dat"                                     ' micro config file
$crystal = 8000000                                          ' internal resonator
$prog &HFF , &HC4 , &HD9 , &H00                             ' sets fuse bits.
'
Config Adc = Single , Prescaler = Auto                      ' config ADC
Dim Spl_sensor As Byte
Dim Range_sensor As Byte
'
Config Porta = Output                                       ' config ports
Config Portb = Output
Config Portc = Output
Config Portd = Output
'
Rm Alias Portd.6                                            'track directional motor controls
Rma Alias Portd.5
Lm Alias Portd.4
Lma Alias Portd.3
E Alias Portd.2
'
Drum4a Alias Portd.7                                        'drum drive enables
Drum4b Alias Portc.0
Drum1a Alias Portc.1
Drum1b Alias Portc.2
Drum2a Alias Portb.0
Drum2b Alias Portb.1
Drum3a Alias Portb.2
Drum3b Alias Portb.3
'
Ld1 Alias Portc.6                                           'for drum LED's
Ld2 Alias Portc.5
Ld3 Alias Portc.4
Ld4 Alias Portc.3
Ld5 Alias Portb.4
Ld6 Alias Portb.5
'
Ld1 = 1                                                     'lights off
Ld2 = 1
Ld3 = 1
Ld4 = 1
Ld5 = 1
Ld6 = 1
'
Config Timer0 = Counter , Edge = Rising                     ' config timer
Start Counter0
'
Dim Z As Bit                                                ' used as a compare for repeating stuff
Dim Y As Byte                                               ' for repeating routines
Dim X As Byte                                               ' for general counting
Dim Tempo As Integer                                        ' tempo's generate drum patterns for the 4 bars
Dim Times2play As Integer                                   ' generates number of times to play a drum pattern
Dim Drum As Integer                                         ' generates which drum to play for a drum beat
Dim Pause As Integer                                        ' generates the pause between drum beats
'
Dim Times2playrepeat As Integer                             ' used to save value to repeat the riff
Dim Drumrepeat As Integer                                   ' used to save value to repeat the riff
Dim Temporepeat As Integer                                  ' used to save value to repeat the riff
'
'
'
Wait 3                                                      ' start up delay
'
Do
'
Z = 0                                                       ' define starting value
Gosub Servo_center                                          ' servo scan
Waitms 25
Gosub Servo_right
Waitms 25
Gosub Servo_center
Waitms 25
Gosub Servo_left
Waitms 25
'
Counter0 = Rnd(10)                                          ' playing random music, and save values
For Y = 0 To Counter0
Gosub Setup
For X = 0 To Times2play
Gosub Play
Next X
Waitms 250
'
Gosub Setup                                                 ' play new random riff
For X = 0 To Times2play
Gosub Play
Next X
Waitms 250
'
Gosub Setup_2                                               ' repeat first riff
For X = 0 To Times2play
Gosub Play
Next X
Waitms 250
'
Gosub Setup                                                 ' play new random riff
For X = 0 To Times2play
Gosub Play
Next X
Waitms 250
'
Gosub Setup_2                                               ' repeat first riff
For X = 0 To Times2play
Gosub Play
Next X
Waitms 250
'
Gosub Setup_2                                               ' repeat first riff
For X = 0 To Times2play
Gosub Play
Next X
Waitms 250
Next Y
'
Wait 1
'
'
Loop
'
End
'
'
Setup:
Counter0 = Rnd(17)
If Counter0 > 16 Then                                       ' limit counter0 to range 1-16
Counter0 = 1
End If
If Counter0 < 1 Then
Counter0 = Counter0 + 1
End If
'
   Counter0 = Rnd(16)
   Drum = Counter0                                          ' used to define which drums to use
   If Drum > 15 Then
   Drum = Drum / 2
   End If
   If Drum < 1 Then
   Drum = Drum + 1
   End If
   If Z = 0 Then
   Drumrepeat = Drum
   End If
'
      Counter0 = Rnd(29)
      Tempo = Counter0                                      ' used to define the tempo
      If Tempo > 28 Then
      Tempo = Tempo / 2
      End If
      If Tempo < 1 Then
      Tempo = Tempo + 1
      End If
      If Z = 0 Then
      Temporepeat = Tempo
      End If
'
         Counter0 = Rnd(7)
         Times2play = Counter0                              'used to define the times to play
         If Times2play > 6 Then
         Times2play = Times2play / 2
         End If
         If Times2play < 2 Then
         Times2play = Times2play + 1
         End If
         If Z = 0 Then
         Times2playrepeat = Times2play
         End If
            Z = 1
Return
'
Setup_2:
Drum = Drumrepeat
Tempo = Temporepeat
Times2play = Times2playrepeat
Return
'
Play:
Select Case Tempo                                           'used to define the tempo
Case 1 : Pause = .965                                       ' 4/4
   Case 2 : Pause = .93
      Case 3 : Pause = .895
         Case 4 : Pause = .86
            Case 5 : Pause = .825
               Case 6 : Pause = .79
                  Case 7 : Pause = .755
                     Case 8 : Pause = .72                   ' 8/4
                        Case 9 : Pause = .685
                           Case 10 : Pause = .65
                              Case 11 : Pause = .615
                                 Case 12 : Pause = .58
                                    Case 13 : Pause = .545
                                       Case 14 : Pause = .51
                                          Case 15 : Pause = .475
                                             Case 16 : Pause = .44       ' 16/4
                                                Case 17 : Pause = .405
                                                   Case 18 : Pause = .37
                                                      Case 19 : Pause = .335
                                                         Case 20 : Pause = .3
                                                            Case 21 : Pause = .265
                                                               Case 22 : Pause = .23
                                                                  Case 23 : Pause = .195
                                                                     Case 24 : Pause = .16
                                                                        Case 25 : Pause = .125
                                                                           Case 26 : Pause = .09
                                                                              Case 27 : Pause = .055
                                                                                 Case 28 : Pause = .02
                                                                                    End Select
'
If Drum = 1 Then                                            'these are used to turn on or off the drums
Gosub D1a
Waitms 36
Gosub D1b
Waitms Pause
End If
   If Drum = 2 Then
   Gosub D2a
   Waitms 36
   Gosub D2b
   Waitms Pause
   End If
      If Drum = 3 Then
      Gosub D3a
      Waitms 36
      Gosub D3b
      Waitms Pause
      End If
         If Drum = 4 Then
         Gosub D4a
         Waitms 36
         Gosub D4b
         Waitms Pause
         End If
            If Drum = 5 Then
            Gosub D1a
            Gosub D2a
            Waitms 36
            Gosub D1b
            Gosub D2b
            Waitms Pause
            End If
               If Drum = 6 Then
               Gosub D1a
               Gosub D3a
               Waitms 36
               Gosub D1b
               Gosub D3b
               Waitms Pause
               End If
                  If Drum = 7 Then
                  Gosub D1a
                  Gosub D4a
                  Waitms 36
                  Gosub D1b
                  Gosub D4b
                  Waitms Pause
                  End If
                     If Drum = 8 Then
                     Gosub D2a
                     Gosub D3a
                     Waitms 36
                     Gosub D2b
                     Gosub D3b
                     Waitms Pause
                     End If
                        If Drum = 9 Then
                        Gosub D2a
                        Gosub D4a
                        Waitms 36
                        Gosub D2b
                        Gosub D4b
                        Waitms Pause
                        End If
                           If Drum = 10 Then
                           Gosub D3a
                           Gosub D4a
                           Waitms 36
                           Gosub D3b
                           Gosub D4b
                           Waitms Pause
                           End If
                              If Drum = 11 Then
                              Gosub D1a
                              Gosub D2a
                              Gosub D3a
                              Waitms 36
                              Gosub D1b
                              Gosub D2b
                              Gosub D3b
                              Waitms Pause
                              End If
                                 If Drum = 12 Then
                                 Gosub D1a
                                 Gosub D2a
                                 Gosub D4a
                                 Waitms 36
                                 Gosub D1b
                                 Gosub D2b
                                 Gosub D4b
                                 Waitms Pause
                                 End If
                                    If Drum = 13 Then
                                    Gosub D1a
                                    Gosub D3a
                                    Gosub D4a
                                    Waitms 36
                                    Gosub D1b
                                    Gosub D3b
                                    Gosub D4b
                                    Waitms Pause
                                    End If
                                       If Drum = 14 Then
                                       Gosub D2a
                                       Gosub D3a
                                       Gosub D4a
                                       Waitms 36
                                       Gosub D2b
                                       Gosub D3b
                                       Gosub D4b
                                       Waitms Pause
                                       End If
                                          If Drum = 15 Then
                                          Gosub D1a
                                          Gosub D2a
                                          Gosub D3a
                                          Gosub D4a
                                          Waitms 36
                                          Gosub D1b
                                          Gosub D2b
                                          Gosub D3b
                                          Gosub D4b
                                          Waitms Pause
                                          End If
Return
'
D1a:
Ld1 = 0                                                     'on
Drum1a = 1
Drum1b = 0
Return
'
D1b:                                                        'off
Ld1 = 1
Drum1a = 0
Drum1b = 0
Return
'
D2a:
Ld2 = 0
Drum2a = 1
Drum2b = 0
Return
'
D2b:
Ld2 = 1
Drum2a = 0
Drum2b = 0
Return
'
D3a:
Ld3 = 0
Drum3a = 1
Drum3b = 0
Return
'
D3b:
Ld3 = 1
Drum3a = 0
Drum3b = 0
Return
'
D4a:
Ld4 = 0
Drum4a = 0
Drum4b = 1
Return
'
D4b:
Ld4 = 1
Drum4a = 0
Drum4b = 0
Return
'
L_turn:
Rm = 0
Rma = 1
Lm = 1
Lma = 0
E = 1
Ld5 = 0
Ld6 = 0
Return
'
R_turn:
Rm = 1
Rma = 0
Lm = 0
Lma = 1
E = 1
Ld5 = 0
Ld6 = 0
Return
'
Brake:
Rm = 0
Rma = 0
Lm = 0
Lma = 0
E = 0
Ld5 = 1
Ld6 = 1
Return
'
Forward:
Rm = 0
Rma = 1
Lm = 0
Lma = 1
E = 1
Ld5 = 0
Ld6 = 0
Return
'
Reverse:
Rm = 1
Rma = 0
Lm = 1
Lma = 0
E = 1
Ld5 = 0
Ld6 = 0
Return
'
Servo_center:
For X = 1 To 75
Pulseout Portc , 7 , 3100
Waitms 13
Next X
Return
'
Servo_left:
For X = 1 To 75
Pulseout Portc , 7 , 1250
Waitms 13
Next X
Return
'
Servo_right:
For X = 1 To 75
Pulseout Portc , 7 , 4990
Waitms 13
Next X
Return

 

Thanks for Looking!!!

Navigates around and plays a random drum beat.

  • Actuators / output devices: drum motors, lights, speakers
  • Control method: autonomous
  • CPU: Atmel Mega32
  • Power source: A regular 9v for micro, and 4.8v in AA's for regulation voltage, and 9v in AA's for source voltage.
  • Programming language: Bascom Basic
  • Sensors / input devices: Sharp IR, ZXSound sensor
  • Target environment: indoors
Flag this post

Thanks for helping to keep our community civil!


Notify staff privately
It's Spam
This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.

You flagged this as spam. Undo flag.Flag Post