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

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/this-is-my-new-robot-named-fdr-futurama-drum-robot

Yeah! yet another drum bot!

 

Yeah! yet another drum bot!

Yeah! yet another drum bot! The more they come the better :smiley: nice job!

I like the design…and the little robots on the side. funny detail! (maybe add some color?)

Welcome to the club! :stuck_out_tongue:

RE:

I have in front of me (literally while I type this) 8 LEDs that I’m adding to this robot. I’m going to make them blink with the drum beats, and light up the cartoon characters on the sides.

 

like to see that! should be
like to see that! should be nice…

Looks Good
Very nice. Thanks for the code. I can now see PBASIC is very similar. More homework to learn someday. I also use plastic alot for appearance and easy to work with.

Just a little thing: I dont

Just a little thing: I dont know exactley how bascom basic works, but you should take a look at the “Select Case” command. that way you could write your code some shorter. like this:

Select tempo

case 1 : Pause = .9925

case 2 : Pause = .4962

case 3 : Pause = .3308

end select

 

instead of:

If Tempo = 1 Then 'these are used to properly time the drum beats
End If
If Tempo = 2 Then
Pause = .4962
End If
If Tempo = 3 Then
Pause = .3308
End If

 

Still have to say your code is looking more properly then my code… lol. You know how these things goes, constantly chancing Things, adding features.

Good work! Go so further.

RE:

Yeah I agree with your code advice. Of the skills it takes to make robots, programming is my weakest skill. So my code is always in need of some cleanup, or could be written in a better way. But as long as it works…I’ll make this correction when I post the next round of code.

I’ve got a few more things to get working, like a new recorder board, the sound pressure sensor, the Sharp ranging sensor, guitar sounds, etc.

RE:
I messed up. This isn’t the newest code, or what I’m presently running. I’ll fix it… DOH!!!

RE

Ok, its time to dust this thing off and add some more sounds!!!

I’m going to have to do some testing to see which way I can get better tones from the side speakers.

My previous attempts failed due to errors on my part. ~DOH!!!

The best method will either be from a DAC board to drive the amp. Or a driver board to PWM the speakers directly without the amp.

(You can’t drive this much load directly from a micro pin.) So testing will be the only way to know which way is better.

I previously tried a piezo buzzer which didn’t make good tones.

 

I’m also thinking about swapping the controller over to an Arduino Mega, as I’ve learned to like Arduino’s a lot more than Bascom.

 

mmm if i understand

mmm if i understand correctly u want to add a record/playback capability?

with the stuff needed to make that work, u could also rig up a sort of electronic drum with
a piezo element so u or the bot can assign different sounds to it.

like this guy did with his mousemat:
http://www.youtube.com/watch?v=HctUQTxMXEM

piezo elements look like this:

|x


kinda looks like a cymbal :wink:

 

 

Cool project!
The leds in the drums are a cool touch. I bet it looks really cool in low light.
Did you make the drums from pvc or are the a found object like a flashlight handle or something?
I was wondering if the beats are just purely random (hit or no hit) or if you have it randomly sequence 16 beats then loop that a few times. (i didnt read the code which i’m sure would answer that q)

Suggestions.

You know what would make the sound/music ‘THAT’ much better? Go to dollar story and buy a set of those cheap chimes. That would be just amazing! The robot itself is amazing! 

RE

Did you make the drums from pvc or are the a found object like a flashlight handle or something?

The drums are made from shelf post covers. Here’s where I bought them:

http://www.harborfreight.com/4-tier-shelf-rack-91883.html

 

I was wondering if the beats are just purely random (hit or no hit) or if you have it randomly sequence 16 beats then loop that a few times.

Bascom has a random number function that I call on over and over in this code. I use these random numbers to choose the drums, tempo, times to play, etc. The only part of this code that isn’t random is when I tell it to repeat the previous drum riff so that it actually sounds like some form of music. If I didn’t have the repeat structure then it would just be a string of random taps. The repeat structure I use is play riff1, riff2, riff1, riff2, riff2.

Once I get more sounds going from the robot playing in time with these drum taps it will sound more like music than it does presently.

 

RE

I tried a sound recorder and didn’t like what I got from it.I had problems with keeping the playback in time with the drum tempo.

 

I tried having it make beeps from a piezo but didn’t find what I’m looking for there either. Bascom has a “sound” function that is its own loop which is determined by pulses and duration. The timing problem is worse using this function because its adding a loop inside of my loop, so I have to add another timing adjustment to fit it all in the limited amount of time of the drum riff.

When I speed it up to play within the timing limit, it starts sounding like modem noise!!!

 

I’m going to shop around the dollar stores like suggested above and see what I can find to hack.