Comprehensive menu with one single button and one LED replaces DIP switch
Comprehensive Arduino menu with just one single button and one LED
Microprocessor based electronics often have jumpers or dip switches for settings. But on very small PCBs there is not enough place, see for instance my Yamaha battery dongle:
Arduino menu with one button
I have therefore developed a menu system that requires just one button and one LED, without a display. In the user manual below you can see how the menu works. The one button menu is also a cheap alternative to dip switches, especially 1.27mm pitch dip switches are expensive:
DIP switches instead of a menu
One button and one LED menu replaces DIP switch
Software
I haven't had time to make a nice library of the one button menu yet. Please contact me for the code.
Menu selection
There are 5 menus. Click the button for 2 seconds to select. The leds will now flash. Example: to select menu 2, click after the 2e flash, The selected menu will be executed now.
Menu 1-5
- Set the specified battery capacity in Ampere hour [Ah]. This is default set to 12Ah. See also “Set battery capacity”. To show the Ah value, see menu 2.
- Show the specified battery capacity in [Ah]. See also “Show values”.
- Set the fuel gauge temporarily to full. Don't use this, it only for testing.
- Set a new charge cutoff voltage. Enter this menu when the battery is fully charged. The battery voltage will be measured and stored automaticly. The default value is 41V.
- Show the charge cutoff voltage. See also “Show values”.
1 Set the specified battery capacity
We have to set the battery capacity manually before use. The default value is 12Ah. The allowed range is from 1.0Ah to 69.0 Ah.
- The ledbar flashes fast.
- Enter the tens 1*)
- The ledbar flashes fast.
- Enter units.
- The ledbar flashes fast.
- Enter the decimal. You can skip the decimal by doing nothing anymore.
1*) For a zero: click the button immediately after the ledbar flashes fast. For a number n from 1-9: click after n flashes.
Example 23Ah
- The ledbar flashes fast.
- Count 2 led flashes and then click.
- The ledbar flashes fast.
- Count 3 led flashes and then click.
- The ledbar flashes fast.
- Click the button immediately or do nothing anymore.
Example 20Ah
- The ledbar flashes fast.
- Count 2 led flashes and then click.
- The ledbar flashes fast.
- Click the button immediately for the zero.
- The ledbar flashes fast.
- Click the button immediately or do nothing anymore.
Example 1.2Ah:
- The ledbar flashes fast.
- Click the button immediately (since tens = 0)
- The ledbar flashes fast.
- Count 1 led flash and then click.
- The ledbar flashes fast.
- Count 2 led flashes and then click.
Example 300mAh = 0.3Ah
- The ledbar flashes fast.
- Click the button immediately (since tens = 0)
- The ledbar flashes fast.
- Click the button immediately (since tens = 0)
- The ledbar flashes fast.
- Count 3 led flashes and then click.
If the battery capacity is set too low, the fuel gauge will display 0% while the battery is still not empty. This is shown with a blinking red led.
Show values
This works in the same way as setting the specified battery capacity but with just showing flashing leds.
Example 45Ah
- The ledbar flashes fast.
- The led flashes 4x.
- The ledbar flashes fast.
- The led flashes 5x.
- The ledbar flashes fast.
- No flashes since there are no decimals
- The ledbar flashes fast.
Example 4.6Ah
- The ledbar flashes fast.
- No flashes since there are no tens.
- The ledbar flashes fast.
- The led flashes 4x.
- The ledbar flashes fast.
- The led flashes 6x.