element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Andy Clark's Blog Fizz Buzz Game - Driving the LCD
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Workshopshed
  • Date Created: 4 Mar 2018 8:52 AM Date Created
  • Views 1254 views
  • Likes 9 likes
  • Comments 7 comments
  • i2c
  • circuitpython
  • lcd 16x2
Related
Recommended

Fizz Buzz Game - Driving the LCD

Workshopshed
Workshopshed
4 Mar 2018

Following on from the game prototyping I've started on the hardware.

 

To display the numbers I wired up a small LCDsmall LCD I had spare from earlier experiments. It's a "Chip on Glass" model so it's very small and has an inbuilt I2C slave chip that's compatible with the ST7032i.

image

image

As well as these pins there's a back light on the side of the LCD that needs powering. I added a resistor and drove that from the supply line of the Trinket. The LCD also has an inbuilt voltage booster to allow it to be run from 3v (same as the trinket) but I thought I'd try and keep the component count down and decided to run that from the 5v supply too. I used some 2K2 resistors to pull up the I2C bus to the 3v output on the Trinket and hoped the LCD would be ok with that.

 

After a few experiments I settled on Visual Studio Code for editing and Putty for diagnostics. I connected to the serial port of the Trinket and it's pretty good at reporting issues with the code, "missing name" was the most frequent error I saw which was an indication my libraries/includes were not quite right.

 

I tried the example of I2C scan from Adafruit and that did work (once I'd remembered to connect the 0v rail for the LCD), that reported the LCD was present at 0x3E.

 

I then tried the Adafruit character lcd libraries but those just reported that there was no enough space on the trinket. I looked at the data sheet and some old arduino code and contemplated writing my own library. A bit of googling found me an example from boochowp which was a ESP32 variant with MicroPython. ESP32 + MicroPythonでLCDモジュールに文字を表示させてみた: 楽しくやろう。

 

The library needed a few tweaks to the includes and a "lock" adding but I eventually had some text appearing. I then spent ages trying to find the right function to turn a character into it's ASCII integer value and eventually stumbled on "ord" which seems to work nicely.

https://github.com/Workshopshed/FizzBuzz/blob/master/st7032i.PY

 

import board
import busio
from st7032i import ST7032i

i2c = busio.I2C(board.SCL, board.SDA)

lcd = ST7032i(i2c)

#Write ABC
for c in "Hi Workshopshed":
    lcd.write_data (ord(c))

image

 

Next up, some hardware buttons.

  • Sign in to reply

Top Comments

  • Workshopshed
    Workshopshed over 7 years ago in reply to beacon_dave +2
    Ah, I see. I thought it was a new board based on the ATSAMD21. One to watch out for when getting a cheap copy from an auction site.
  • beacon_dave
    beacon_dave over 7 years ago in reply to Workshopshed +2
    It appears to be catching out some parents who are buying it with the intention for their children to be able to use it with MakeCode https://makecode.com/ but finding out they have ended up with the Developer…
  • genebren
    genebren over 7 years ago +1
    Andy, Nice write-up. A very clean solution to attaching to LCD. I sure do see a lot of python being written these days. I guess that I might have to check it out. Gene
  • beacon_dave
    beacon_dave over 7 years ago in reply to Workshopshed

    It appears to be catching out some parents who are buying it with the intention for their children to be able to use it with MakeCode https://makecode.com/ but finding out they have ended up with the Developer/Classic version based on the ATmega32U4.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Workshopshed
    Workshopshed over 7 years ago in reply to beacon_dave

    Ah, I see. I thought it was a new board based on the ATSAMD21. One to watch out for when getting a cheap copy from an auction site.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • beacon_dave
    beacon_dave over 7 years ago in reply to Workshopshed

    If you can get your head around the different versions it would appear. image

    Developer, Classic (3000) and Express (3333).

     

    Developer and Classic look to be similar, both based on the ATmega 32U4 and working with Arduino and Code.org.

     

    Looks like Developer may have been the predecessor to Classic but it's not clearly stated. Some places appear to be listing the Developer version as Adafruit part number 3000 though.

     

    Express based on the ATSAMD21 and working with Arduino, MakeCode and CircuitPython. (future support planned for Code.org).

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Workshopshed
    Workshopshed over 7 years ago in reply to genebren

    The Adafruit Circuit Playground has potential

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 7 years ago in reply to Workshopshed

    Andy,

     

    I have still not experienced Raspberry Pi (I did just order a Pi zero), so I don't have that in my background.  Even with the raspberry Pi, I would guess that I would most likely use C, as this is the most used tool in my tool belt. Still, it would be nice to broaden my horizons, and some of these tiny SBCs look like fun.

     

    Gene

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube