Choice of Display module.

tommo_NZ

New Member
I have written some code for and built a universal 8 port timer using a 20m2, an RTC module and 2 x 4 way relay boards. I have been adjusting the sequences viewing the output via the serial terminal. I would like to include a 2 line led display so users won't need to learn how to program it. My question is which led display is the cheapest and simplest to implement with little code. I have very little code space left. Thanks in advance.
Regards, Kevin Thompson.
 

Aries

New Member
I have very little code space left.
Regards, Kevin Thompson.
There are threads in the forum on using I2C-based displays. Have you used both slots on the 20M2? If not, you have another 2048 bytes of code space available with a bit more programming.


Edit: corrected available code space
 
Last edited:

lbenson

Senior Member
Easiest, not cheapest--one pin needed on picaxe: https://www.picaxestore.com/picaxe/add-on-modules/axe131y

Cheap, not easy: https://www.ebay.com/itm/1602-162-16x2-Character-LCD-Display-Module-HD44780-Controller-Yellow-Blacklight/233430267095

Cheap, middling, complex code, but good picaxe examples available: https://www.ebay.com/itm/Blue-Background-IIC-I2C-TWI-1602-LCD-16x2-Serial-Module-Display-for-Arduino/402244336372

If I2C, may as well go with 4 lines: https://www.ebay.com/itm/Blue-Serial-IIC-I2C-TWI-2004-20X4-Character-LCD-Module-Display-For-Arduino-Tool/192741612934

Post #9 here has a PCB for 20M2 with a Nokia 5110 LCD: https://picaxeforum.co.uk/threads/08m2-and-14m2-sip-boards-with-eagle-pcb-files.25538/
 
Last edited:

Buzby

Senior Member
... and simplest to implement with little code. I have very little code space left. ...
Hi Kevin,

No matter what display device you choose you will still need quite a lot of code to drive the user interface and process user the inputs.

I would first write a simple specification for what values need adjusting, then how the user interacts with the device.

You haven't said what your timers are. Are they countdown timers, or repeating timers, or programmable HH:MM:SS with multiple events ?. Each type of timer requires a different set of adjustable values. Make a list of these.

Then decide how does the user adjust these values. For instance, does he press up/down buttons to select timers and adjust values, or does he use a seperate set of buttons for each timer, or will he use a numeric keypad, or a rotary switch ?.

Then you will need to decide how all of this is to be displayed on a few LED digits. A 20x4 display gives you a much more flexible canvas to work on than a single-line 8 digit LED, which means less 'menu selections' to let the user get to the relevant value, which means less code to write.

There is a lot more to building a user interface than just choosing a display !.

Cheers,

Buzby
 

geezer88

Senior Member
You might consider the Nextion display: https://nextion.tech/

It's not cheap, but it gives you both a display and touchscreen input. The device has enough power to take a fair load off the Picaxe and uses a simple uart interface. Advanced models have real time clock and 8 bit gpio.
tom
 

AllyCat

Senior Member
Hi,

Perhaps the most important question is how many "spare" pins do you have? Then the issues already raised: Really a "LED" display? Cheapest are usually LCDs, (often LED-backlit), now being replaced by OLEDs. How much program space is available (as Buzby says, UIs need lots of space), including that second slot (using PE6)?

As you already have an I2C RTC, an I2C display needs zero extra pins. The AXE13x displays need only one pin (which might be the Programming Serial Output pin using SERTXD) and they have plenty of extra space in their internal (18M2) PICaxe to accommodate Menu / Text strings, etc.. The cheapest LCD character displays need 10 pins for their normal parallel interface, but their 4-bit mode can reduce that to about 6 pins, or the (optional) I2C "backpack" to none. Finally, there are the tiny, cheap, low power OLED displays using the SSD1306: I2C so no additional pins are required; pixel-mapped, so they do need a character lookup table, but not out of the question if that second slot / table memory (or an external EEPROM) is available (watch this space. ;) ) .

Cheers, Alan.
 

Buzby

Senior Member
Hi Kevin,

I found your post from May last year ( https://picaxeforum.co.uk/threads/to-poll-rtc-or-not-to-poll-rtc.31503/#post-326442 )

A Picaxe controlled device that can control up to 8 IO ports ... The user can enable or disable any port, can set multiple on/off times up to 14 per 24 hour period. The clock can be set from within the application.
The device uses the sertxd function and gives feedback via the usb programming cable to a small application on a PC (Termite).
Looking at the code you posted, it looks like you already have a menu structure and data entry method working, using buttons for control and 'sertxd' to show the display.

If this is so, then your best option is to use something like AXE134 serial OLED. Then basically all you will need to do is change is the 'sertxd' statements to 'serout', keeping all the rest of the code as is.

An interesting project, please keep us informed.

Cheers,

Buzby
 

tommo_NZ

New Member
Hi Kevin,
I found your post from May last year ( https://picaxeforum.co.uk/threads/to-poll-rtc-or-not-to-poll-rtc.31503/#post-326442 )
Looking at the code you posted, it looks like you already have a menu structure and data entry method working, using buttons for control and 'sertxd' to show the display. If this is so, then your best option is to use something like AXE134 serial OLED. Then basically all you will need to do is change is the 'sertxd' statements to 'serout', keeping all the rest of the code as is.
An interesting project, please keep us informed.
Cheers,
Buzby
Thanks Buzby, you have encapsulated the project nicely, I had purchased a couple of "I2C 1602 LCD Board Module 16x2 Character LCD Display Module HD44780 Controller " but had no luck getting meaningful output. I can set the full range of parameters needed from setting time to selecting outputs etc. via the programming port and a serial terminal but I don't think the end user would want to learn how to install the USB software and purchase a cable. I shall look at the AXE134 solution again. Many thanks for the encouragement.
Regards, Kevin Thompson
 

tommo_NZ

New Member
There are threads in the forum on using I2C-based displays. Have you used both slots on the 20M2? If not, you have another 2048 bytes of code space available with a bit more programming.


Edit: corrected available code space
I shall have a look at the code space issue, thanks.
Regards,
Kevin Thompson
 

Buzby

Senior Member
... I don't think the end user would want to learn how to install the USB software and purchase a cable. ...
Another solution, a bit more 'off the wall', but reasonably simple to implement.

Replace the AXE027 cable with a serial UART BlueTooth module ( there's dozens on eBay, and they cost pennies ), then use a free 'serial terminal' app on a smartphone.

With no modification to your code you could still use the red/blue buttons, but with a few mods to the code you could use keypresses on the phone.

Just an idea.

Cheers,

Buzby
 

tommo_NZ

New Member
There are threads in the forum on using I2C-based displays. Have you used both slots on the 20M2? If not, you have another 2048 bytes of code space available with a bit more programming.
Edit: corrected available code space
Thanks Aries, I had seen reference to the second code space but did not find much in the way of documentation. However, now it seems it is so simple and I wonder why it is kept a secret. It seems not much is said about techniques and I assume it is not supported in simulation. Thanks again, it is a partial solution to a problem, I mean to have all the code for the main loop on slot 0 and jump to slot 1 for the menus where the parameters are adjusted.
Regards,
Kevin Thompson.
 

lbenson

Senior Member
It's certainly not a secret, but it mostly comes up in the forum when someone says they're running out of memory.

It would seem that a "state machine" type of organization would be perfect to use with slots, but a search of "state machine slot" turns up no results.

People have sometimes found this image useful:
MEM-SLOT.jpg

Perhaps a state machine something like this:
Code:
do
  select state
    case 0: gosub initialize
    case 1: run 1
    case 2: gosub sub2
    case 3: run 1
  end select
loop
"initialize" sets the state to 1; in slot 1, a SELECT statement executes sub1 or sub3 depending on "state"; they set state=2 and then RUN 0, etc.
 
Last edited:

tommo_NZ

New Member
It's certainly not a secret, but it mostly comes up in the forum when someone says they're running out of memory.
Thanks lbenson, I was being a bit dramatic using the word 'secret' but would like to see more presence and explanation in the documentation. Maybe it has sufficient explanation but as an old fart I sometimes gloss over the bits I don't fully comprehend. I must do better. It has made so much difference to my project, I can now include bits that I had previously removed.
Thanks to you and all for the responses.
Regards,
Kevin Thompson
 

lbenson

Senior Member
I sometimes gloss over the bits I don't fully comprehend.
I hear you there. Or I don't read the manual at all. I was fortunate that the second slot on the 20M2 became available with PE6 at exactly the time I needed it (one day after I ran into a wall), so I pursued a solution (and have remembered it).
 

tommo_NZ

New Member
.... I was fortunate that the second slot on the 20M2 became available with PE6 at exactly the time I needed it (one day after I ran into a wall), so I pursued a solution (and have remembered it).
Thanks lbenson, the 'Picaxe M2 Summary' would have been a good place to introduce that feature. But, my question is, how do you guys simulate code that runs across 2 or more code spaces. I will have to put my main code, assignments and definitions in slot0 and jump to slot1 for menus etc. Would it work if I set the environment to a chip with 4096b of code space and ran it that way, then seperated them before uploading to the 20M2?
regards,
Kevin Thompson.
 

lbenson

Senior Member
Would it work if I set the environment to a chip with 4096b of code space and ran it that way
I would suppose so, assuming you're not using other features of the 20M2 that wouldn't be there for the 20X2.
It might be most closely simulated with something like this
Code:
do
  select state
    case 0: gosub initialize
    case 1: 
#ifdef _20M2 
       run 1
#else
       gosub somewhere
#endif
    case 2: gosub sub2
    case 3: 
#ifdef _20M2 
       run 1
#else
       gosub somewhereelse
#endif
  end select
loop
 

hippy

Senior Member
Would it work if I set the environment to a chip with 4096b of code space and ran it that way, then seperated them before uploading to the 20M2?
That's probably the best way; use a 20X2 for development then split into two slots for the 20M2. In practice there are very few differences with the X2 which would trip you up when switching to an M2.

Appreciating you might not want to; it is arguably easier and better to just move to a 20X2 and be done with it, avoid the complications of two slot programming.

It's also worth looking at whether you can optimise the code to get it to fit in a single slot, though that is less likely if you do have a lot of message text as would likely be the case for a menu system.

You could however limit the amount of menu and text while developing, only include the rest when it comes to using both slots. That would however depend on how much other code you had.
 
Top