Projects:Badge/Documentation

From SHA2017 Wiki
< Projects:Badge
Revision as of 22:12, 17 June 2017 by Sebastius (talk | contribs) (Troubleshooting)

Jump to: navigation, search

Badge Badge project - Documentation - Github - Sponsorship - Organisation

Introduction

On this page you'll find all the hints, tips, datasheets, secret codes and assorted stuff you'll need to hack the SHA2017 Badge!

Before the event

You can try out some micropython using the Badge Emulator

Getting started!

Just got your badge and want to get going?

Hardware

Components

Design

Add-Ons

  • Screenprotector?
  • 3D printable case
  • Laser cut case

Expansion Boards

Repository of scarves

  • Proto-board
  • At-least one more project in the works . .
Expansion port
GND LED_POWER IO_33 IO_16 IO_17 I2C_SCL
3V3_SWITCHED GND IO_12 IO_4 LED_DATA_OUT I2C_SDA

Hacks

  • Weatherproofing? Nailpolish seems to do the trick. Switches on the back will probably be unusable after applying it...

Software

Currently we have two flash-able Firmware flavours . .

We also have an Emulator to try out some code before you put it on your badge.

Building

TLDR: Clone https://github.com/SHA2017-badge/Firmware and follow the instructions there to flash a new version.

Prerequisites

You'll need some tooling, on Debian systems this should be sufficient:

sudo apt-get install libncurses5-dev flex bison gperf

Cloning and setting up your environment:

git clone https://github.com/SHA2017-badge/Firmware.git
cd Firmware
git submodule update --init --recursive
source set_env.sh
make defconfig

Optionally change configuration:

make menuconfig

Compiling and flashing the Pure C Firmware

make flash

Compiling and flashing the Miropython Firmware

make
cd micropython/mpy-cross
make
cd ../esp32
make deploy
cd ../..

Interacting with the badge

You can use your favourite serial terminal client or user the builtin monitor.

make monitor

Installing on non Debian-based systems

For specific issues read the ESP-IDF Windows Setup Guide Mac OS Setup Guide or Linux Setup Guide

Compiling and using the Badge Emulator

cd micropython/unix
make axtls
make
./micropython

Using Micropthon

Connect to the badge with a micro USB cable and use your favourite serial client.

We have some higher level api's available . . currently a fast moving target 😁

This example code displays some graphics and text:

import badge, ugfx

badge.init()
ugfx.init()

ugfx.clear(ugfx.BLACK)

ugfx.thickline(1,1,100,100,ugfx.WHITE,10,5)
ugfx.box(30,30,50,50,ugfx.WHITE)

ugfx.string(150,25,"STILL","Roboto_BlackItalic24",ugfx.WHITE)
ugfx.string(130,50,"Hacking","PermanentMarker22",ugfx.WHITE)
len = ugfx.get_string_width("Hacking","PermanentMarker22")
ugfx.line(130, 72, 144 + len, 72, ugfx.WHITE)
ugfx.line(140 + len, 52, 140 + len, 70, ugfx.WHITE)
ugfx.string(140,75,"Anyway","Roboto_BlackItalic24",ugfx.WHITE)

ugfx.flush()

Read more at the MicroPython and modules page.

Display

To talk to the e-ink display, the high-level uGFX library that comes with the firmware is the easiest way to get started. A more low-level API is available under components/badge/badge_eink.h if you need it (e.g. for advanced hacks like greyscale imagery).

Troubleshooting

Display

Sluggish

When a display responds sluggish (more than on other badges) or is for instance unable to clear the display in one pass, check the soldering on the display connector first.

Ghosting

When you update the display too frequently without proper clearing cycles (inverted image, black screen, white screen, positive image) you may experience something that looks like it was burned in. You can recover your screen by doing the black and white flashes (LOTS of them). Also letting the display rest (without power!) seems to alleviate the issue. So expect ghosting/burn-in when you are doing animations. We do not know the long term effect of (ab)using the display like this.

Removing

Removing the display is not something we recommend. Break it at your own risk. The trick seems to be to first remove the cable from the connector on the back, pull it through the hole. Now you can carefully push and wiggle the display downward towards the buttons. If you're lucky the glue-dots havent hardened yet and you can remove the display. Come by the badge tent for new gluedots when you're done (limited supplies).

MPR121

Touch not working

Check the soldering on the MP121. Reflow if necessary.

LED power not working

If your LEDs aren't getting any power either the MPR121 or the transistor is suspect.

Buzzer motor not working

Either the MPR121 or the transistor are suspect