HOME - - - - - - - - Table of contents, my Arduino "How To" articles
Other material for programmers      Recommend to StumbleUpon

Challenge! ATtiny85 programming- Cash prizes!

For people who can program ATtiny85

(and a smaller competition for Arduino programmers)

(Filename: aht8d-ATtiny Morse Chall.htm)

You know you'd do it for fun, anyway!


I will set out a challenge to the ATtiny85 community. If you can create the application I'm hoping for, you're in line for cash!

Worried this is a scam? Wise! It could be. But read the following carefully, and you'll see that all you have to lose is a little time, time spent doing something some people would find fun.

Stop press! It can be done! But the competitions ARE still running!

Hurrah! A very kind person, Edgar Bonet, took on the challenge... for the fun of it! He wanted to do a few things differently than as required to enter the competition, but went ahead anyway, and is sharing, for free, his solution. That is becoming available as a kit of parts.

circuit for ATtiny Morse code decoder

On the left: His circuit. It comes from Edgar Bonet's Github page.

A PCB for this circuit has been made up as PCB271, for which separate pages have been created. How to obtain one, assemble it, explained there. Not expensive... less than $20 incl p&p for the PCB and programmed ATtiny. The rest is just annoying bits and pieces.

Back to the challenge

This started as a competition for ATtiny people. A competition for Arduino people has been added. The terms are the same as for the ATtiny competition, apart from if you use an Arduino you are inline for a smaller cash prize. The $40/ $60/ $20 ATtiny numbers become $20/ $30/ $10. Also, in the Arduino "class", you don't have to send any hardware, just a clear description of how to set any Arduino up to test your code. (Quality of user documentation will play a big role in who wins the Arduino class. There should be two separate documents for users: One that's just about how to use one that's been set up. (This would probably be quite short... it doesn't have to be a course in how to send Morse code!) And a separate document to say what to connect to the Arduino to provide what is needed. And the interval between first finished entry being announced, and the deadline for submitting further entries would be extended to two months. For the Arduino version, the winning entry would have to be able to recognize all of the codes in the table given at Wikipedia.

Basic Idea

Here's my idea. By all means, write, suggest changes...

  1. Create something in an ATtiny, using the Arduino IDE.
  2. Check this page to see if prizes already won. (You can still do the following, if you're willing to share what you've done. Contact me first to settle fees for your trouble and the parts.)
  3. Contact me, to say you're ready. Send the sourcecode. Understand: This is partly to get something fun "out"... by participating, you agree to give away all your rights to the code. An effort WILL be made to give you credit for creating it.
  4. Anyone who's told me that they are working on an entry will be contacted, told they have three weeks to finish entry.
  5. Send me a programmed, "ready to go" ATtiny. You may have to do a little tweak at that point to set the baud rate of the serial output to something I will tell you then. Pester me to put something about baud rate here, and maybe the re-programming nuisance can be avoided. I will test it, see if I think it does what is claimed. And I will keep it. One reason you should contact me before sending it is so that we can find a mutually agreeable figure for your payment for the goods and p&p ahead of time. (You get that whether you win any prize money or not... if we "spoke" before you sent the hardware.)
  6. I'll assess things as they come in, and shortly after the three weeks is up, will announce a winner, here.
  7. Winner gets at least $40, or, if no other entries arrive, $60. (US dollars throughout. I will pay you via Paypal, or some other way, if it suits both of us.) (On top of the payment for the device and p&p, which will have been sent previously.) For each additional entry that arrives in time, working, even a bit, I will add $20 to the Prize Fund, which I will divide between the entries, as I see fit, 1st prize being, as I said, at least $40.

Don't hesitate to get in touch if that needs clarification or tweaking.

I frequently speak of wanting this done in an ATtiny85. And I might well stick to that. (Except, of course, in respect of the separate, smaller competition.) No doubt ATtinys come in variants. If a different one would suit you... more program memory, perhaps?... do get in touch. If it is programmed the same way, and doesn't cost a lot more, and I find I can order them easily, they could be brought within the rules of the competition.

What are the design requirements?

Your job is to create a little program to go into an ATtiny85. Hardware: (Here's the diagram from the top of the page again.)...


A momentary switch ("push button"), and LED, and wires to go to an external display capable of turning a stream of TTL ASCII signals into a display of letters. (I will provide the display. If your program can make messages appear in the Arduino Serial Monitor, you can do this too. In fact JUST sending them to the Serial Monitor (at the right rate) may be enough... I can probably tap the line that the Serial Monitor watches, and get what I need from that. (Pester me to determine that.))

As a user presses the button, if he/ she does so in a way that constitutes proper Morse code, at the right speed, the letters the Morse stood for will appear on the screen. The LED will be lit whenever the button is pressed, just as an "is the switch working" confirmation.

I believe "the right speed" is as follows. If a "dit" is "one" unit long, then...

(I'm no Morse expert... if you can send me a link to some authoritative site with a different specification, please do so!)

Indeed, if you have any suggestions about revising elements of this, please let me have them! Contact details at the bottom of the page. (I will be reluctant to change major elements of the competition after the first entry's submission has been announced, so please get those suggestions in soon!

"Frills" allowed... and will be used in judging "best entry". For instance, one of the GPIO lines could have a toggle switch on it. Set one, way, the "MorseReaderATtiny" (the name for this... please use in code, file names, etc, etc) will "understand" Morse sent at one speed, set the other, it will only understand it the code is coming at a different speed. The switch should be set up to provide one speed which is suitable to a rank beginner, and one that works for someone with some.. but not much!... idea of what they are doing.

By the way.. fell free to incorporate any "copyright left" material you can gather from the web... but please do the decent thing, and credit the originators with comments in the sourcecode. This will in no way diminish your chance of winning a prize. It might even enhance it, if you Do It Well!

Another by the way: The standard of the coding, i.e. what a programmer sees looking at the sourcecode, will be part of what I used to determine prizewinner(s). My decision on that final, by the way. I'm paying the piper, so... as they say.

You may have wondered about the red and green in my diagram, and the wavy lines. I meant to indicate the bits you must send me... red... and the bits I will supply... green. The wavy lines are there to say that I don't have strong views on what lines you use for what. I am new to ATtiny85 work, I'm not sure what restrictions apply. For instance, I don't know which lines are used by the Arduino IDE's programming and Serial Monitor. (Someone please let me know? I would prefer that neither be used, at least for the core design requirements, and that the signal for my TTL Serial Display be on a second line, even if it is merely duplicating what's on the output pin the IDE's monitor uses. (If you are pretty sure that two lines, duplicating a signal, are a bad idea, please write, let me know.)

The device should work (displaying the output on the IDE's monitor) with JUST the circuit on the left present. (And Vcc and Ground, of course.) If you've added frills, like the speed adjust switch mentioned above, great, and I will test them... eventually. Your MorseReaderATtiny should work with JUST the assets I've just listed. If there's something like the speed adjust input, the system should default to the most friendly settings.


By the way... Please spread the word?? If you think others would find this page interesting, "http://bit.ly/MorseReader" is a quick way to get here!

Just before we go on, to talk a bit about the coding, here are some images of a "first stab" at putting together a Morse decoder using Edgar Bonet's ATtiny solution. You plug it into a USB port (or mere charger). You tap the "key". The translation into characters appears on the LCD display. E.g., you tap "dot-dot-dot dash-dash-dash dot-dot-dot", and "SOS" appears on LCD screen.

The serial display cost about $25. And yes, you got me, the "Morse Key" is just a microswitch held in place with a few bits of wood. Hurrah for hot-melt-glue guns! (If you want to buy me a better key on eBay, feel free. When I looked, the cheapest was $30. This is meant to be a bit of fun, not something for Neiman Marcus!)

((q-alt text for image))
((q-alt text for image)) ((q-alt text for image))

A simple PCB for general ATtiny purposes is available. It was made for the Morse Reader. Details in the page the link takes you to. Costs about $3.

((q-alt text for image))

A bit about the coding

The MorseReaderATtiny should cope with all of the codes which consist of just three dots or dashes. I/e. it should be able to recognize an R (dot dash dot), but doesn't have to recognize a P (dot dash dash dot). It will count quite heavily against you, though if that is all it can manage. Full alphabet would be much better. Anything beyond that: not necessary, but will get you some "bonus" points.

I imagine you will create some variables or constants in your code with values for the following. I don't expect you need all of them, but please use these names if you make them "byte-type" data, or as follows but starting "i" if you prefer to use an integer type.


Work through the names with me from top to bottom, which won's always be "left-to-right, top-to-bottom. (Why isn't there a word for that, and let's, please, not go down a "LTRTTB" path here! Pity something as grand as "boustrophedic" (a similar concept) hasn't been invented!)

If you work top to bottom (only, forgetting left to right), you'll get the terms in the order of how big the numbers will be, I think.

You don't have to work with these parameters in your code. But if you do, please refer to them thus.

bDitMin would be the smallest value. It would be the minimum time the signal has to be high to be seen as ANYTHING. Anything shorter than bDidMin is just ignored. (In this section, where ever I say things like "shorter than", feel free to add an "or equal to".) (I haven't put it on the diagram because I don't think the program needs it, but if you want to put a bOffMin in the program, to say, "if signal low between highs for less than bOffMin, ignore the brief off", then please use that name.

bDitMax (which MAY be the same as bDashMin) is the longest time that should count as a dit.

bDashMin, bDashMax similarly define dashes.

bBetweenLettersMin,-Max is for saying how long the line has to be low for the program to treat the "off" time as the break between two letters. In a moment I will use . for dot, _ for dash. Does the following...

      ._ _._.

Mean ANN or EMR? It depends on some slightly longer pauses the sender will put in, as follows... "/" means longer pause. (If I've got my example right!...

      ._ / _. / _. = ANN
      . / _ _ / ._. = EMR

(In children's book, The Mysterious Benedict Society, that issue is used very cleverly. (A sender isn't doing it very well, making it hard to spot the inter-letter breaks.) (It only took me ten minutes to recall the title! Even Google needed help, but eventually "childrens' book abducted orphans take over world island Morse code" did the trick! If you like programming challenges, there's a "riddle" in the book that I've wasted hours on, and a program might make solving it fairly easy. (There's a garbled- by- poor- spacing message at the end of the book that needs interpreting.)

bBetweenWordsMin works the same way. A longer than "bBetweenLettersMax "zero" (signal low) means that not only have we come to the end of a letter, but also to the end of a word. Itissomucheasiertoreadthingswithbreaksbetweenthewords. (But try typing something like that? Your "do a space" reflex will be strong, I think you'll find.

If a "zero" goes on for a very long time, no problem! The program just sits in a loop, watching, so the display sits as it was left when the last letter was decoded. Simples.

Another bonus points opportunity: I suspect it would be quite easy to incorporate a "scaling factor", a way to make a change in just one place (even if it had to be done at the time the software compiled, uploaded to the ATtiny85), and have all (that you are using) of the various numbers indicated above get bigger or smaller, while retaining their original ratios. (In M. Bonet's proof of concept, he uses two pins to allow you four speed settings, which can be chosen by links.)

That's it?

That's it, I hope!

   Search this site or the web        powered by FreeFind
  Site search Web search
Site Map    What's New    Search

The search engine is not intelligent. It merely seeks the words you specify. It will not do anything sensible with "What does the 'could not compile' error mean?" It will just return references to pages with "what", "does", "could", "not".... etc.
In addition to the tutorials for which this page serves as Table of Contents, I have other sites with material you might find useful.....

Sequenced set of tutorials on Arduino programming and electronics interfacing.
Tutorials about the free database supplied with Open Office version 2.
      (If you experienced Adabas with Star Office, ooBase is nothing like it!)
Some pages for programmers.
Using the parallel port of a Windows computer.

If you visit 1&1's site from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service.

Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!

Click here to visit editor's Sheepdog Software (tm) freeware, shareware pages.

And if you liked that, or want different things, here are some more pages from the editor of these tutorials....

Click here to visit the homepage of my biggest site.

Click here to visit the homepage of Sheepdogsoftware.co.uk. Apologies if the "?FrmAht8d" I added to that link causes your browser problems. Please let me know, if so?

Click here to visit editor's pages about using computers in Sensing and Control, e.g. weather logging.

To email this page's editor, Tom Boyd.... Editor's email address. Suggestions welcomed!

Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org

Why does this page cause a script to run? Because of the Google panels, and the code for the search button. Why do I mention the script? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....