Close
0%
0%

IMTAIDKW - ESP12 4-digit display

I made this and I don't know why

Similar projects worth following
I found 4-digit displays in our hackerspace, I made a board with ESP-12 and 74HC595 that drives the display. I also wrote the code for driving the display from MicroPython. Now, the question is - what do I use this board for?

Features:

  • 4 digits that need to be driven dynamically from ESP8266 - considering that digits are driven using a 595 and it all runs under MicroPython, it's kinda slow
  • 5V input and onboard 3.3V regulator (Chinese 1117) - which can be bypassed by a solder jumper
  • GP2, GP0, TXD, RXD and ADC pins are free and accessible (okay, TXD and RXD are not very accessible) (also, it appears that GP0 can't drive open-collector things, IIRC because it has a pulldown)

Current usage:

  • Lying on the hackerspace floor, broadcasting poop emoji SSID and displaying "1337"
  • Showing temperature from two temperature sensors (still broadcasting the poop emoji SSID)

Things to play with:

  • MicroPython inline assembly - maybe I can speed up the shiftOut function? (Viper - done)
  • Making a clock
  • Using MQTT and a DS18B20 (DS18B20 code here)
  • Make my first actual IoT project

  • Temperature ​meter code added

    Arya07/23/2017 at 23:21 0 comments

    Our hackerspace had an old Pro Mini-based board with two DS18B20 sensors that used to measure temperature inside and outside our hackerspace's main room, mostly for shits&giggles. Now, I took the IMTAIDKW, attached those sensors to it and wrote some code: 

    def run(sleep_time=0.0001, cycle_counter=50000, update_counter=10000, format_counter=10010, trigger_counter=5000):
        #Good luck understanding this lol
        global thermometers, current_thermometer, is_error, digit_bytes
        print("Hello!")
        prev_i = 3
        run_counter = 0
        while True:
            for i, digit_byte in enumerate(digit_bytes):
                isr = machine.disable_irq()
                shiftOut(digit_byte)
                columns[prev_i].on()
                latch.on()
                columns[i].off()
                machine.enable_irq(isr)
                run_counter += 1
                if run_counter >= cycle_counter:
                   print("cycling through thermometers")
                   current_thermometer += 1
                   if current_thermometer >= len(thermometers):
                       current_thermometer = 0
                   print("current thermometer: {}".format(current_thermometer))
                   run_counter = 0
                elif run_counter % update_counter == 0:
                   print("getting temperature")
                   try:
                       temperature = ds.read_temp(thermometers[current_thermometer])
                   except (OneWireError, IndexError):
                       print("sensor {} failed".format(current_thermometer))
                       is_error = True
                   else:
                       temperatures[current_thermometer] = temperature
                   if is_error:
                       thermometers = ds.scan()
                       if not thermometers:
                           print("no sensors found!")
                           digit_bytes = [mapping[char] for char in " err"]
                       else:
                           is_error = False
                elif run_counter % format_counter == 0 and not is_error:
                   print("formatting temperatures for display")
                   temperature = temperatures[current_thermometer]
                   if type(temperature) != float:
                       print("wrong temperature {1} for sensor {0}!".format(current_thermometer, temp_str))
                   else:
                       temp_str = "{:.1f}".format(temperature)
                       print("sensor {} has temperature {}".format(current_thermometer, temp_str))
                       digit_bytes = generate_digit_bytes(temp_str, thermometers[current_thermometer])
                elif run_counter % trigger_counter == 0:
                   print("updating temperatures")
                   try:
                       ds.convert_temp()
                   except OneWireError:
                       is_error = True
                       thermometers = ds.scan()
                       if not thermometers:
                           print("no sensors found!")
                           digit_bytes = [mapping[char] for char in " err"]
                       else:
                           is_error = False
                sleep(sleep_time)
                prev_i = i
    

     .. Yeah, good luck reading that. The full code is here: https://github.com/CRImier/IMTAIDKW/blob/master/software/temperature_meter.py

    I also attached a light sensor to the analog port, but I don't feel like I can be arsed to write the code that does something useful with it. That's going to be it on IMTAIDKW for now!

    I'll add some photos of this setup later - though, frankly, I don't care enough, so it's unlikely I actually will.

  • shiftOut ported to MicroPython Viper

    Arya07/09/2017 at 16:20 0 comments

    @micropython.viper
    def shiftOut(data: int):
        GPIO_OUT = ptr32(0x60000300) # GPIO base register
        GPIO_OUT[2] = 0x10 # clear pin 4
        for i in range(8):
            value = data & 1<<i #Is bit set or cleared?
            reg = 2-(value >>i) #Selecting set or clear register - clear reg is 2, set reg is 1
            GPIO_OUT[reg] = 0x8000 #set or clear data bit
            GPIO_OUT[1] = 0x20 # set bit 5
            GPIO_OUT[2] = 0x20 # clear bit 5
    instead of
    def shiftOut(byte):
        latch.off()
        for i in range(8):
            value = byte & 1<<i #Is bit set or cleared?
            data.value(value)
            clock.on()
            clock.off()
    Is it going to be faster? IDK, I asked about it on MicroPython forums to figure out - and also to make sure there are more Google-able examples of toggling GPIOs from Viper code. New example is here: https://github.com/CRImier/IMTAIDKW/blob/master/software/test_viper.py

  • Test code is up

    Arya07/09/2017 at 14:27 0 comments

View all 3 project logs

Enjoy this project?

Share

Discussions

Ken Yap wrote 05/02/2019 at 04:43 point

You'd need something that can take advantage of the ESP32 otherwise if it's just a serial interface 4 digit LED display those are only a dollar or two on eBay. Search on TM1637, and TM1638 for the 8 digit version.

  Are you sure? yes | no

davedarko wrote 09/29/2017 at 17:54 point

Could you add a screenshot of the schematics? 

  Are you sure? yes | no

davedarko wrote 09/29/2017 at 17:54 point

please :)

  Are you sure? yes | no

Elliot Williams wrote 07/15/2017 at 18:30 point

You'll find the right use for it, or put it in a hackerspace with a TCP port open and 20 people will find the wrong use for it!  :)

Seriously, I have eight RGB LEDs hooked up to an ESP8266, subscribed to a data channel. Sometimes I've used it to indicate free memory, sometimes incoming e-mail, sometimes when the videos I'm downloading are done.  

Keep it general-purpose.  The use will find you.

  Are you sure? yes | no

davedarko wrote 07/09/2017 at 15:14 point

Some Ideas:

 - an NTP clock

 - online weather / temperature display

 - youtube / instagram / twitter subscriber counter

 - something with the hackaday API (skull / like counter)

 - a tea timer

 - unread email counter?

 - deadline countdown

 - inventory display

 - server ping time display

I'm out of ideas, but I always wanted to brainstorm what one can do with a 4-digit display other than displaying the time.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates