Menu

A fun little horn project

Moto Geek
2017-04-16
2017-12-16
  • Moto Geek

    Moto Geek - 2017-04-16

    I used GCB to make a replacement horn for my motorcycle. It works great thanks to great cow basic. I put it up on github...

    https://github.com/motogeeking/Reggae-Horn-V1.0

    Thanks to developers. I love me some GCB!!!!

     
  • William Roth

    William Roth - 2017-04-18

    Nice Project

    Thanks for sharing it.

     
  • Anobium

    Anobium - 2017-04-18

    Winner of the Project of the Month!!!

    Nice job. Nicely published.

     
  • stan cartwright

    stan cartwright - 2017-04-24

    I couldn't see the mp3 player type but the command codes look the same as one i have. Here's the help for mine if it's of use. http://www.picaxe.com/docs/spe035.pdf

     
  • Moto Geek

    Moto Geek - 2017-12-14

    This project has been pretty popular with a bunch of buddies, there have been about 14 of them hand built and installed on motorcycles so far that I know of. I have made some requested changes to the code and have added a 10k trim pot to the circuit to change the start-up and cycle volume. It also can now play up to 99 different startup sounds and 99 different horn sounds. There is really no practical use for so many sounds, but we have been averaging about 10 or so just for fun.

    The code has been updated to include added functionality and is heavily commented at the request of some new users of GCB friends of mine. Link to V2.0 is here...

    https://github.com/motogeeking/Reggae-Horn-V-2.0

    Having too much fun with GCB and "converting" some of the arduino types around here...

     
  • bed

    bed - 2017-12-14

    Yeah!
    Moto has now 2 Projects in the show case Corner of our Homepage.

     

    Last edit: bed 2017-12-14
  • mmotte

    mmotte - 2017-12-14

    Great Project! I have some DFPlayers just waiting to do something.

    Perfect presentation and good commenting in the code.

    BR
    Mike

     
  • stan cartwright

    stan cartwright - 2017-12-14

    I intend to use a picaxe mp3 player on a robot with a glcd for a face as commercial toy robots do.

     
  • viscomjim

    viscomjim - 2017-12-15

    Stan, that is awesome! Please post some code to share when you get that going, especially the face part (maybe using bitmaps?). I am working on using a pic16f18326 to do some bitcoin mining. The glcd part is giving me some issues, but once I get a handle on the PPS tool, I should be good. Have you ever tried to overclock the pic? I'm trying to get 128Mhz going to help with the math, but no luck so far. I may have to alter the .dat files to "trick" the compiler into 128mhz. Your thoughts???

     
    • bed

      bed - 2017-12-15

      I am working on using a pic16f18326 to do some bitcoin mining

      It's a joke, isn't it?

       

      Last edit: bed 2017-12-15
      • William Roth

        William Roth - 2017-12-15

        Bitcoin mining with a PIC @ 32Mhz? As I understand it, It barely pays the cost of electricity with a Quad XENON System and 100Mb Internet connection.

         
  • William Roth

    William Roth - 2017-12-15

    No way a 32 MHz PIC can be overclocked to 128MHz. It might make 40MHz if you are lucky. If you want 128MHz, you will need to change chips types and compilers.

     
  • viscomjim

    viscomjim - 2017-12-15

    I am working on using a pic16f18326 to do some bitcoin mining
    It's a joke, isn't it?

    Yes, my feable attempt a pic humor...

     
    • bed

      bed - 2017-12-15

      Well, then I can be proud to have really recognized it .... Although, I had asked, but not so smart of me ;-)

       
  • stan cartwright

    stan cartwright - 2017-12-16

    Can you help please. I have a picaxe mp3 player. Seems very similar. it has button pads that play the tracks in /mp3/0001.mp3 format. picaxe says use 7 bytes as cmd and ignore as below but I used your horn code as a start. I get no sound from my enclosed program. The buttons work. Anything obvious I'm doing wrong. tx to tx,rx to rx http://www.picaxe.com/docs/spe035.pdf
    is it the same..ish as in your bike horn? I never got around to using it in picaxe and don't like asking cos it's from picaxe.
    ps... so a rpi is not going to get me any bit coins...something else it can't do...like most things it's supposed to do.
    ;
    The general command format is
    .----------- (vv) Version = FF
    |
    | .-------- (ln) Number of bytes vv+ln+cm+fb+dh+dl = 06
    | |
    | | .-- (fb) Use 01 if one wants an echo response
    | | | back from the module TX serial pin
    | | |
    7E FF 06 cm 00 dh dl ch cl EF
    cm = command
    dh dl = data for the command
    ch cl = checksum = 0 - vv - ln - cm - fb - dh - dl
    Some technical datasheets display a checksum ‘ch’ and ‘cl’ as part of the serial data. However the
    module seems to completely ignore the checksum and does not care whether the checksum is given
    or not. Therefore for simplicity it is omitted in all PICAXE examples, which therefore gives the
    command sequence format
    7E FF 06 cm 00 dh dl EF
    Note that filename numbers in the serial command list below is given in hex (not decimal)
    e.g. to play file
    \02\222.mp3
    which is folder 02 (0x02) track 222 (0xDE) - the command sequence of bytes would be
    serout pin, T9600_8, ($7E,$FF,$06,$0F,$02,$DE,$EF)

    #chip mega328p, 16
    #option Explicit
    
    #define TX portd.1
    #define RX portd.0
    
    #define MP3Busy portc.6                     ' Busy line from MP3 -> low = busy
    
    #define USART_BAUD_RATE 9600                ' Initializes USART port with 9600 baud
    #define USART_BLOCKING                      ' wait for USART to finish receiving or transmitting
    
    dir TX out                                  ' Set pin 7 to output - TX out to MP3 module RX
    dir RX in                                   ' Set pin 6 to input - RX in from MP3 module TX                               ' Set pin 5 to input
    dir MP3Busy in                              ' Set pin 2 to input
    
    dim Cmd(10)                                 ' Set up MP3 player send command array
    Cmd = 0x7E, 0xFF, 0x06, 0x0F, 0x00, 0x01,0x01,0x00,0x00, 0xEF       ' 10 byte TX array
    dim track,tmp as byte
    do
    track=0x01
    MP3SendCmd
    
    wait 500 ms
    loop
    
    sub MP3SendCmd
    cmd(7)=track
    for tmp = 1 to 10
        HSerSend Cmd(tmp)
    next tmp
    end sub
    

    ;

     

    Last edit: stan cartwright 2017-12-16
  • Moto Geek

    Moto Geek - 2017-12-16

    The first thing that comes to mind is that you have tx to tx and rx to rx. The tx of the MP3 module has to go to the rx of the pic. The rx of the MP3 module has to go to the tx of the pic. You don't have to use the rx of the pic (so that includes the tx of the MP3) if you are not going to process any of the info sent back from the MP3 module. I'll take a look at your code also, but check that first...

    And, yes, it is the same module I am using. The board may be from picaxe but the mp3 module is not.

    One quick thing I noticed in your code, should it work without the checksum, is that you are telling it to play track 1 over and over again every 1/2 second. If you have your busy line connected to the pic, just do a wait while MP3Busy = 0 kind of thing if you want the whole track to play to the end...

     

    Last edit: Moto Geek 2017-12-16
  • stan cartwright

    stan cartwright - 2017-12-16

    Cheers Moto. Connecting mega tx to mp3 rx still no play. In the following code cmd(7) is the track. cmd(6) is the folder named mp3. The tracks are 0001.mp3,0002.mp3, just short beeps for robot.

    wait 4 s
    dim Cmd(10)                                 ' Set up MP3 player send command array
    Cmd = 0x7E, 0xFF, 0x06, 0x0F, 0x00,0x00,0x01,0x00,0x00, 0xEF       ' 10 byte TX array
    dim track,tmp as byte
    do
    track=0x01
    MP3SendCmd
    
    wait 2 s
    loop
    
    sub MP3SendCmd
    cmd(7)=track
    for tmp = 1 to 10
        HSerSend Cmd(tmp)
    next tmp
    end sub
    
     
  • stan cartwright

    stan cartwright - 2017-12-16

    I sorted it. The play command seems to be 0x12. Works for any track. No check sum. Nothing to set up. I will use the mp3busy line. Neat player.

    dir TX out                                  ' Set tx to output - TX out to MP3 module RX
    dir RX in                                   ' Set rx to input - RX in from MP3 module TX                               ' Set pin 5 to input
    dir MP3Busy in                              ' Set pin to input
    wait 4 s
    dim Cmd(8)                                 ' Set up MP3 player send command array
    Cmd = 0x7E, 0xFF, 0x06, 0x12, 0x00,0x00,0x00, 0xEF       ' 8 byte TX array
    dim command,track,tmp as byte
    
    do
    command=0x12:track=0x01
    MP3SendCmd
    wait 2 s
    loop
    
    sub MP3SendCmd
    cmd(4)=command:cmd(7)=track
    for tmp = 1 to 8
        HSerSend Cmd(tmp)
    next tmp
    end sub
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.