This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

2x16 LCD and Rotary Encoder

Hello,

I've been looking around to find the best way to interface the nRF52 DK with both an LCD screen for printing settings to a panel display, and a rotary encoder, used to scroll through and enter into various menus.

The rotary encoder would be any simple 5pin quadrature or 2bit grey code input that I could find, and the LCD screen would be something like this: www.newhavendisplay.com/nhd0216k1zflybw-p-284.html

I have worked with components like this extensively on Arduino and simpler interfaces but don't understand the software/coding necessary to get these working for the nRF52. I am confident I can hook them up properly however, which is a good first start.

I really have no idea where to begin and would like to find the simplest and most straightforward method of learning to interface these components.

Any help would be greatly appreciated.

Thanks and Regards

  • Do you want to port these libraries from Arduino/AVR platform to nRF52?

  • If that would make the most sense I'd be willing to learn about it. What does that entail and how could I do that?

    Thanks

  • Your question is somewhat ambiguous, what you want is whether a programming skill of the nRF5x platform or how to work external components such as hd44780 LCD. As a rule, everything is possible to do that you can do on AVRs. For example, the things you need in order to work a LCD are ways to handle GPIO pins and delay function. That's all. All you have to do are to translate source codes from the Arduino libraries.

    If you want to learn the basic programming skill of the nRF5x, you should examine examples of nRF5x SDK, the peripherals in particular. IF you are not good at the Keil MDK or the Eclipse platform, ARM mbed Developer Site is a good starting point for you.

    I'm afraid I could not have been of more assistance.

  • Personally I wouldn't recommend starting with the arduino drivers which in most cases (unless they were custom written for an nrf51 chip) are bitbangers.

    The rotary coder shouldn't be too hard, the nrf51 has a QDEC peripheral built in which scans and reports movement on any compatible input device. There's a driver in the SDK for it, nrf_drv_qdec, which follows the same basic method of use of any of the other nordic drivers. Don't think there's an example for that one, but if you look at some of their general example code, you should get the idea.

    LCD, you'd be better off with one with a I2C or SPI interface, if I read that one correctly it's got a 7-bit wide one which is possible to do, but again the nrf51 series has I2C and SPI peripherals, and drivers, and examples, so reading and writing those are easy.

    Rotary encode and LCD .. not a reflow oven is it? :)

  • Hey.

    As @RK mentioned, the nRF52 as a QDEC peripheral. This will take care of the wheel decoding. You will of course interface it correctly with your code. You can learn this from the product specification ,qdec driver documentation and the QDEC example code.

    The display can be used with simple gpio instructions. I agree with RK in that a display using i2c or SPI might be "cleaner" to implement. (it will require less connections)

    I assume that you are going to have a radio connection while doing this. Remember that using delays (busy wait delays like nrf_delay) will not work well together with BLE connections. Use a periodic timer to trigger periodic tasks, to let the CPU work with other things in between.

Related