Morse code LED as a display panel for a battery tester - Ham advice needed - Page 1
Forum section: electronics / rf-microwave

author: RoGeorge
author_rank: Super Contributor
timestamp: April 12, 2019, 02:10:49 pm
content: Never used Morse code before, so no idea about what are the common sense rules when using Morse code for (optical) signaling. The intention is to use a blinking LED instead of a digital display.To be more specific, let's say we have a 4 channels battery tester/discharger for AA batteries. There are no buttons, no LCD, just a LED. When a new battery is inserted, the discharger starts the discharging automatically, and end it when the battery is completly drained out. We want to know two things: Which batteries are still discharging, and in the end, how many mAh each battery has. Roughly said, we want to display a table like this:Code:Batt 1 Batt 2 Batt 3 Batt 4ON 121mAh OFF 1875mAh OFF 1834mAh OFF 2163 mAhQuestions:1. Which Morse code to use?https://en.wikipedia.org/wiki/File:Morse_comparison.svg2. What character to use for ON/OFF indication, or how to encode this info?3. The plan was to continuously send only the mAh numbers, no letters, for example: 121 1875 1834 2163 long_pause 121 1875 1834 2163 long_pause ...4. Which one would be easier to understand, grouping the ON/OFF status for all 4 batteries in front of the numerical values, or interleaving?(1 0 0 0 121 1875 1834 2163 long_pause) or(1 121 0 1875 0 1834 0 2163 long_pause) ?No clue how to make those values easier to read on a single blinking LED, any other ideas are welcomed.

author: richard.cs
author_rank: Super Contributor
timestamp: April 12, 2019, 02:37:46 pm
content: Use ITU Morse, as I understand it no-one uses the others, at least not in amateur radio.Wikipedia: "Morse's original code specification, largely limited to use in the United States and Canada, became known as American Morse code or railroad code. American Morse code is now seldom used except in historical re-enactments."I'm not sure how well Morse on a blinkenlight will work, most people learn it by sound and I'm not convinced that translates easily to watching an LED. What's the advantage of using Morse for this application? Just cost/space saving?

author: RoGeorge
author_rank: Super Contributor
timestamp: April 12, 2019, 03:22:55 pm
content: Quote from: richard.cs on April 12, 2019, 02:37:46 pmYes, the device is in fact very simple, just a MOSFET with two resistors and a capacitor connected to a microcontroller (here an Arduino nano board), and for normal use it is connected to a computer.It would be nice to be able to use the discharger without a computer and without adding extra hardware. All the logging and charting is nice, but after all, the main usage is to plug a battery in the discharger, and a few hours later to read how many mAh were there. Even so, it will be used only when a battery seems to last less than expected, maybe a few times a year at most.The reading speed is not important, maybe some other blinking will be more readable than Morse, yet I never used Morse code so I thought it would be good to ask before implementing the blinking (and also learning Morse).

author: NivagSwerdna
author_rank: Super Contributor
timestamp: April 12, 2019, 03:28:41 pm
content: Numbers in morse are a PIA. Maybe you should reconsider it as a mechanism?

author: tsman
author_rank: Frequent Contributor
timestamp: April 12, 2019, 03:34:45 pm
content: The sequence will be longer but if you're sending just digits then just blinking a count would mean anybody can see the value. You don't need to remember morse code for it.Morse or a simple blink count is going to be really annoying to read though. Keep it simple and use the LED to show status. Save the last few readings into EEPROM. If you want to know the battery capacity then plug it into a PC or have an optional header to plug in one of those cheap OLED modules.

author: ebastler
author_rank: Super Contributor
timestamp: April 12, 2019, 03:40:06 pm
content: Quote from: NivagSwerdna on April 12, 2019, 03:28:41 pmYes, please reconsider!!Especially if you want to send a sequence of values, for multiple batteries. Who wants to stare at the stupid LED for seconds on end to find the start of the sequence, then read all the values?I like morse code, but it's much better listened to than watched on a blinking light. (Back in my navy days, the optical signalling guys weresomuch slower than the radio operators...) And it is a nuisance in this application, no matter whether you use visual or audible signals.Small OLED or LCD displays cost next to nothing. Please use one!

author: ebastler
author_rank: Super Contributor
timestamp: April 12, 2019, 03:42:26 pm
content: Quote from: RoGeorge on April 12, 2019, 02:10:49 pmThe common sense rule is:Don't!

author: luxetveritas
author_rank: Newbie
timestamp: April 12, 2019, 05:24:38 pm
content: BCD is easy to code, and easy to decode in your head.

author: mariush
author_rank: Super Contributor
timestamp: April 12, 2019, 06:15:31 pm
content: You should really reconsider, like everyone says.At the very least, use 4 leds ... and you have a number between 0 and 15 ... and easy to do the math in your head 8 + 4 + 2 + 1If you have some "status" button and you press it... you could have a loop for each battery (turn led 1,2,3, or 4 for 1-2 seconds or blink it for a couple seconds to show for which battery the status is gonna be shown) then turn the leds you want solid for a few seconds. 15 could be completely discharged (if you want to avoid all leds off which could be confusing), 1 to 9 could be 10%..90% turn on the led for the battery.. and 11...14 could be error codes (no battery detected, battery overheating etc)If you want more detailed charge status, you could add something like "hold button" for n seconds to select battery (hold button and every 2-3 seconds the "active battery" is changed and the led for that battery is turned on)... once you release the button, you can then show two or three digits, each digit for a couple of seconds or something like that. So you could show 35% or 15.5%.If you expand to 7 leds, you have a full digit... if you expand to 8 or 9 you could have two dots or status leds, which could be used to keep track of digits .. like dot on left means digit is first digit of 2, dot on right means last digit/only digit. You can drive 7 leds with 3 or 4 io pinsSee page 6 ofhttp://ww1.microchip.com/downloads/en/devicedoc/01146b.pdfor picture below (6 leds on 3 io pins) :As for sending status through serial, maybe consider sending separate messages per battery...battery_no capacity status (charging, discharging, full and or trickle charge, no battery detected, over temperature, battery shorted/dead etc0 1850 CHARGING1 0 NO_BATTERY2 2200 FULL/TRICKLEMaybe get some inspiration from how FTP replies are grouped in categories (like 1xx do some stuff, 2xx something else etc:https://en.wikipedia.org/wiki/List_of_FTP_server_return_codes)so you could send a command likeSTATUS 0and your chip replies200 0 1850 CHARGING (or some code for charging)or your app can send STATUS ALL and then your micro sends one line for each batterybut if you sendSTATUS bogusyour chip could reply501 Error: command not understood, type HELP for list of commands

author: TheSteve
author_rank: Unknown
timestamp: April 12, 2019, 06:31:32 pm
content: If you're not into morse code as part of a hobby etc ask yourself how easy the product will be to use in 6 months when you see the blinking LED.

author: ebastler
author_rank: Super Contributor
timestamp: April 12, 2019, 06:35:31 pm
content: Quote from: mariush on April 12, 2019, 06:15:31 pmOr you could drive a little 1" OLED via I2C, also via three I/O pins!128*64 pixels for around $2, I think.

author: chris_leyson
author_rank: Super Contributor
timestamp: April 12, 2019, 06:55:55 pm
content: I once worked on some equipment designed by Leif Asbrink SM5BSZ and it used to give a Morse diagnostic on boot up

author: DaJMasta
author_rank: Super Contributor
timestamp: April 13, 2019, 05:57:30 pm
content: Low bitrate text? Why not something like RTTYhttps://en.wikipedia.org/wiki/RadioteletypeAs long as your data stream is serial, you can send it over a single LED, then read it out somewhere else.If you really want the LED display to be intelligible by the users, keep it as simple as possible, simpler even than Morse. You can't get nearly that precision, but you could have a sequence of 4 flashes where each on duration was proportional to the current charge in the cell - this won't be intelligible without a key, and it will only be usable for coarse increments (10-15% chunks at best), but it could get the idea across. You could also do a similar thing with fixed durations, but PWM the LED proportional to charge, so you get different brightness levels for different charge status. Moving to 4 LEDs is much preferred, because then either with PWM or pulse duration, you can directly see the comparison to the readout of the other cells, so you can do a much better job comparing their levels and interpret finer resolution steps. Would also make more sense to an end user, maybe still not enough to warrant not looking in the manual, though.If you already have some computational grunt and want a single channel output.... why not a speaker? Doesn't take a super high sample rate to get intelligible speech, you just need a button so you can query the status so it doesn't read it out endlessly.

author: ebastler
author_rank: Super Contributor
timestamp: April 13, 2019, 06:47:33 pm
content: Quote from: DaJMasta on April 13, 2019, 05:57:30 pmSince the idea was to make it human-readable, without the need to connect a teletype machine first?

author: amyk
author_rank: Super Contributor
timestamp: April 14, 2019, 04:42:00 am
content: Use Morse only if you actually need to communicate alphanumerics; otherwise a "count the pulses" code (like a pulse telephone) would probably be sufficient.

author: Circlotron
author_rank: Super Contributor
timestamp: April 18, 2019, 05:16:03 am
content: I once made a tester to show how long an EXIT light would run on it's own batteries, with a single LED flashing the measured duration 0 to 999 minutes. The relevant part of the code is below. It may give you some ideas.Code:****************************************************************************************************;Flash LED in repeating pattern to show actual test time in minutes.;Digit values are contained in HUNDCOUNT, TENCOUNT, UNITCOUNT;LED flashes 100mS times value of digit, 400mS for zero.;4MHz xtal, 68HC908 micro.FLASH_TIME BCLR STAT_LED,PORTB ;in case these were still onBCLR BEEPER,PORTD ;before arriving hereBSET BEEPER,PORTD ;300mS beep to mark button pushMOV #3,LOOPCTR ;JSR MS100DELBCLR BEEPER,PORTDMOVHUNDCOUNT,HUNDCOUNT_2;Reload from these for subsequent loopsMOVTENCOUNT,TENCOUNT_2 ;Actual reload is at bottom of sectionMOVUNITCOUNT,UNITCOUNT_2HUND_FLASHCLRACMPHUNDCOUNT;is digit zero?BNEH_FLASHBSETSTAT_LED,PORTB;then make one 2 sec flashMOV#2,LOOPCTRJSRSEC1DELBCLRSTAT_LED,PORTBJMPHUND_PAUSEH_FLASHBSETSTAT_LED,PORTB;LED ONMOV#4,LOOPCTR;4 LOOPSJSRMS100DEL;OF 100mSBCLRSTAT_LED,PORTB;LED OFFMOV#4,LOOPCTR;4 LOOPSJSRMS100DEL;OF 100mSDBNZHUNDCOUNT,H_FLASHHUND_PAUSEMOV#2,LOOPCTR;2 SEC PAUSE BETWEN DIGITSJSRSEC1DEL***********************************************TEN_FLASHCLRACMPTENCOUNT;is digit zero?BNET_FLASHBSETSTAT_LED,PORTB;then make one 2 sec flashMOV#2,LOOPCTRJSRSEC1DELBCLRSTAT_LED,PORTBJMPTEN_PAUSET_FLASHBSETSTAT_LED,PORTB;LED ONMOV#4,LOOPCTR;4 LOOPSJSRMS100DEL;OF 100mSBCLRSTAT_LED,PORTB;LED OFFMOV#4,LOOPCTR;4 LOOPSJSRMS100DEL;OF 100mSDBNZTENCOUNT,T_FLASHTEN_PAUSEMOV#2,LOOPCTR;2 SEC PAUSE BETWEN DIGITSJSRSEC1DEL***********************************************UNIT_FLASHCLRACMPUNITCOUNT;is digit zero?BNEU_FLASHBSETSTAT_LED,PORTB;then make one 2 sec flashMOV#2,LOOPCTRJSRSEC1DELBCLRSTAT_LED,PORTBJMPUNIT_PAUSEU_FLASHBSETSTAT_LED,PORTB;LED ONMOV#4,LOOPCTR;4 LOOPSJSRMS100DEL;OF 100mSBCLRSTAT_LED,PORTB;LED OFFMOV#4,LOOPCTR;4 LOOPSJSRMS100DEL;OF 100mSDBNZUNITCOUNT,U_FLASHUNIT_PAUSEMOV#5,LOOPCTR;5 SEC PAUSE THEN REPEATJSRSEC1DELMOVHUNDCOUNT_2,HUNDCOUNT;Restore count valuesMOVTENCOUNT_2,TENCOUNT;that were decrementedMOVUNITCOUNT_2,UNITCOUNT;to zero for next loopJMPHUND_FLASH;LOOP TILL RESET BY USER****************************************************************************************************;100mS delayMS100DEL LDA #107STA RAM1LDA #32STA RAM2MS100 DEC RAM1LDA #255CMP RAM1BNE MS100DEC RAM2LDA #255CMP RAM2BNE MS100DBNZLOOPCTR,MS100DELRTS****************************************************************************************************;1 sec delaySEC1DELLDA #62STA RAM1LDA #68STA RAM2LDA #1STA RAM3SEC1 DEC RAM1LDA #255CMP RAM1BNE sec1DEC RAM2LDA #255CMP RAM2BNE sec1DEC RAM3LDA #255CMP RAM3BNE sec1DBNZLOOPCTR,SEC1DELRTS****************************************************************************************************