Shop OBEX P1 Docs P2 Docs Learn Events
Weekend Project: Arecibo Decoder with P2 — Parallax Forums

Weekend Project: Arecibo Decoder with P2

ReinhardReinhard Posts: 489
edited 2023-02-25 14:11 in Propeller 2

In 1974 a message was sent to potential extraterrestrials.
[https://en.wikipedia.org/wiki/Arecibo_message]
The good news for aliens is: With the P2, this message is easy to decode.
An advanced alien naturally has a VGA monitor.
Unfortunately I can't attach the wav file, probably too big.
I detected the 941 Hz with the Goertzel Algo and converted it to a VGA image.
Setting the correct trigger threshold requires some patience. The rest is easy.
So if I can do it, the aliens can do it too.
;)

1024 x 683 - 607K
1024 x 683 - 411K
307 x 808 - 5K

Comments

  • ke4pjwke4pjw Posts: 1,079
    edited 2023-02-25 15:58

    For a moment, I thought you were talking about the WOW! message, LOL! Need more caffeine this morning.

    Great project! Here is a link to the audio: https://en.wikipedia.org/wiki/File:The_Arecibo_Message.wav

    Direct download link: https://upload.wikimedia.org/wikipedia/commons/7/71/The_Arecibo_Message.wav

  • @ke4pjw
    Thank you

    I found the ogg file for download
    https://commons.wikimedia.org/w/index.php?title=File:Arecibo_message_DTMF.ogg

    I can decode it with the octave m-file.
    It has the same sample rate as the wav - file, that I use, think this important.
    It is a Dual Ton Multiple Frequency File. (DTMF) -- 941/1336 Hz
    I trimmed my decoder to detect 941 Hz.
    At the moment not tested with P2, but it must work also.
    I forgot from where I the wav - file received.

  • Now I finish the small project and go to other themes.
    If any is interest, here are all files.
    Needed is the P2 Eval Board with AV Expander and optional a VGA monitor.
    If no monitor on desk, you can use the Build_n_Run octave script, this received the data from P2 and show the result as image.

  • @Reinhard

    I tried to run this with Flexprop with all kinds of errors.

    Did I miss something?
    Thanks.
    Martin

  • @pilot0315 said:
    I tried to run this with Flexprop with all kinds of errors.
    Did I miss something?
    Thanks.
    Martin

    Try a more current Flexbuild first. I think we are at 6.0.4-ish.

  • ReinhardReinhard Posts: 489
    edited 2023-03-30 16:02

    Sorry for late answer.
    I build always from command line, like here
    /home/reinhard/Schreibtisch/Propeller2/spin2cpp-5.9.24/build/flexspin -2 Arecibo_Decoder.c graphictools.c
    so replace
    YOUR_PATH_TO_FLEXSPIN/flexspin -2 Arecibo_Decoder.c graphictools.c
    The SpinVideoDriver is in the subfolder /video

    you can change this in graphictools.h line 24
    // the video object
    struct __using("video/p2videodrv.spin2") vid;

    I don't have the FlexProp Environment here at moment.

  • @Reinhard

    Sorry been really busy. Thanks for the reply I will try to work it out.
    Martin

  • Flexspin takes me to flex prop.
    https://github.com/totalspectrum/spin2cpp/releases

    This is the error I get.
    Thanks

  • dgatelydgately Posts: 1,621
    edited 2023-04-02 15:58

    Flexprop allows copying the compiler/loader output text. A screenshot only shows a small amount of data. It's difficult to assist without all of the compile details.

    The project does compile for me. Notice that all of the directories here do not have spaces. That should not matter, but for some reason I occasionally find that removing spaces from directory names, gets code to compile.

    "/Users/home/flexprop/bin/flexspin" -2 -l --tabs=2 -D_BAUD=230400 -O1    --charset=utf8 -I "/Users/home/source/P2Custom" -I "/Users/home/flexprop/include" -I "/Users/home/flexprop/include/spin" -I "/Users/home/Documents/P2ESCode/p2library" -I "/Users/home/Documents/P2ESCode" -I "/Users/home/source/P2-HUB75-LED-Matrix-Driver/driver" -I "/Users/home/Documents/PropSpinCode/SpinObjects" -I "/Users/home/flexprop/include/libsimpletext" -I "/Users/home/flexprop/include/libwifi" -I "/Users/home/flexprop/include/filesys/littlefs"  "/Users/home/Downloads/P2_Arecibo_Decoder-2/Arecibo_Decoder.c" "/Users/home/Downloads/P2_Arecibo_Decoder-2/graphictools.c"
    Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2023 Total Spectrum Software Inc. and contributors
    Version 6.1.0-beta-v6.0.5-12-g8b855094 Compiled on: Mar 31 2023
    Arecibo_Decoder.c
    |-p2videodrv.spin2
    graphictools.c
    |-p2videodrv.spin2
    memset.c
    fmt.c
    ieee32.c
    vfs.c
    posixio.c
    errno.c
    bufio.c
    Arecibo_Decoder.p2asm
    Done.
    Program size is 360488 bytes
    Finished at Sun Apr  2 08:48:12 2023
    

    Looks like something to do with the following, which does not include a full path:

    // the video object
    struct __using("video/p2videodrv.spin2") vid;
    

    dgately

  • I attach a zip file, this is a zipped shell script, because forum do not allow to upload *.sh.
    You can replace the path in the shell script with your path to the compiler/loader tool.
    In post #3 you have a link to the ogg file, It is not possible to upload the ogg/wav files, they are to big.
    Connect yout Propeller board with soundcard output and with the vga monitor.
    then start the compile and load script from attachment.
    If the monitor get white, start the ogg file.
    The program is waiting til a certain loudness is detected, may be you have to deal with this trigger level, depend the strongness from your soundcard.
    If the triggerlevel is detected, the P2 begin to analyze the DTMF frequency with an goertzel algorithmus. The Coefficient for the algo are precalculated, I can give more info about if any interesset.
    But is not a problem to calculate it on the fly.
    The image is drawing on screen and stays until you terminate the connection with STRG+ALT GR + 9.
    The duration of the message is round about 2 minutes.
    I have tested with the content of zipfile that I upload in post #4, without changes.
    Maybe you can make the handling a bit more comfortable with printf message, the are prepared but commented out in the c source.
    Good Luck
    Reinhard

  • ReinhardReinhard Posts: 489
    edited 2023-04-04 11:23

    Now I installed the newest Version of Flexprop (Version 6.0.5) and I see the same problem at compiletime.
    After some trials I copied the content of graphictool.c into Arecibo_Decoder.c (where the main() is).
    And it works and compile without Errors.
    seems with one C - file plus extern SpinDriver it works, with 2 C-Files it works not.
    I have never seen this problem, because I always compile in old c-style a la cc -o outputfilename file1.c file2.c . . . from command line

    Reinhard

Sign In or Register to comment.