Close
0%
0%

Badge for Hackaday | Belgrade Conference

I have the honour to design the badge for Belgrade Conference. Here it is! Voilà!

Similar projects worth following
The main part of the badge is the red 8×16 LED matrix. There is also an infrared transmitter and five tactile keys, plus RESET key. MCU is Microchip's 8-bit PIC18LF25K50 in 28-pin case, and the power supply is made of two AAA batteries. There are two connectors: USB Micro-B and 5-pin (DW male DIP Header, 2 mm pitch) In-Circuit Serial programming port, convenient for Microchip's PICKIT3 or any other ICD.
The good news is that you don't need any hardware to flash your own code in MCU program memory. There is the bootloader, so all you need is USB cable and bootloader software for PC, which is available and free. So, after the conference all visitors will be asked to write their own programs for the badge.
By default, there will be Tetris and some kind of moving message display. There will be a computer with infrared interface, so everybody will be free to enter his own moving message in his badge.

MPORTANT NOTES:

USB CONNECTOR TYPE IS NOT MINI-A, BUT MICRO-B. PLEASE KEEP THAT IN MIND AND MAKE SURE YOU HAVE THE RIGHT CABLE IF YOU WANT TO HACK THE BADGE!

THE ACCELEROMETER MODULE IS NOT PROVIDED WITH THE BADGE. IF YOU WANT TO USE IT, PLEASE BRING ONE WITH YOU. SUGGESTED TYPE IS GY-521.

________________

HARDWARE:

PCB dimensions are 48×176 mm. 8×16 LED matrix is built of two TA15-11SRWA blocks and refreshed by SCT2024CSSG constant current driver, permanently assisted by MCU. CPU clock is 48 MHz (which is 12 MIPS), so display refresh takes about 1% of processor time. Infrared transmitter is the single 940 nm LED, and the receiver is TSOP6240TTCD, which contains photodetector, AGC preamplifier, 40KHz band-pass filter and demodulator.

All parts are located on the front side of PCB, except batteries, which are on the bottom layer. Connectors, switches and infrared transmitter unit are visible, and all ICs and passive components are located behind LED blocks. Those blocks are in the sockets, so they are easily removable.

The first prototype (on the photo) had only 3 main tactile switches, plus one for ON-OFF-PAUSE control and one for RESET. The new version (which is still unavailable) is modified, and it has one more switch. The difference is visible if you compare photos with drawings and PCB screenshot. The switches are also larger (12×12 mm instead of 6×6).

BOOTLOADER

There is Microchip's MCHPFSUSB bootloader at MCU side, and USB HID Bootloader v2.90a for Windows at PC side. Here is the process of program memory flashing:

1. Write your program and compile (or assemble) it to make HEX file
2. Connect the badge to your PC using USB Mini-A cable
3. Open MCHPFSUSB Bootloader and load your HEX file

4. Click Program icon

As simple as that. MCU accepts HEX file and self-programs itself. As the bootloader must stay intact in program memory range 0x0000-0x0FFF, your program should start at 0x1000. Bootloader will redirect all vectors (Reset, Lo priority interrupt and High priority interrupt) to new addresses, with 0x1000 offset. Bootloader will stay resident in MCU program memory, so it is ready for new program flashing.

KERNEL

The short kernel supports LED matrix multiplex, and is completely located in Timer 2 Interrupt routine. This routine executes uniformly at 800Hz rate, so it enables 100Hz display refresh rate. Inside this routine, there is the key scanning subroutine with debouncer and edge detector, and full ON-OFF-Pause control, using the single key. So, MCU sleeps in Interrupt routine and user does not have to take care of that.

Frame buffer is in RAM, and everything that user writes in 0x700-0x70F will be imediatelly displayed on the LED screen. There is one more auxiliarry buffer, which is not displayed, but used for animated images. The third buffer (0x720-0x72F) is the special frame buffer, which will be displayed only in Pause mode. It may be useful for score displaying, pause symbol or any message.

hid_bootloader.tar.bz2

Bootloader for Linux

Bzip2 Archive - 56.19 kB - 03/16/2017 at 15:52

Download

ChallengeB.HEX

Challenge for Supercon II in Pasadena, modified for the this version of the badge (used at Belgrade conferrence)

hex - 16.20 kB - 12/06/2016 at 20:56

Download

HAD_badge_firmware_source_files.zip

Source files for Hackaday Belgrade Badge. Used for initial PIC18F25K50 programming.

Zip Archive - 509.03 kB - 04/06/2016 at 12:58

Download

Zip Archive - 5.13 MB - 04/06/2016 at 12:58

Download

Hackaday Belgrade Badge Manual v2 r2.pdf

Manual for Hackaday Belgrade Badge hacking

Adobe Portable Document Format - 1012.24 kB - 04/05/2016 at 18:19

Preview
Download

  • Bootloader and Kernel integrated

    Voja Antonic04/01/2016 at 21:19 1 comment

    The new version of firmware, which shall be official at the Hackaday Belgrade Conference, contains the firmware which integrates Bootloader and Kernel function. It occupies 6 K of Program Memory, so there is 26 K available for user code.

    This will make the process of writing the user code significantly easier. Kernel contains the following transparent functions:

    - LED display refresh
    - Debouncer and edge detection for all keys
    - Brightness high/low service in 16 steps, with physiological linearization
    - Pause and Sleep/Wake Up service
    - Optical communication service via serial port, with embedded protocol (which includes serial number as recipient's address)

    There is also Demo Application software, with Moving Message Display, Tetris game and Accelerometer demo software (if hardware module GY-521 is available). This software is not a part of Kernel, ant it will be overwritten at the next software bootloading.

    Details are in the updated PDF file Hackaday Belgrade Badge Manual (version 2), which is in the FILES page

  • Some slides from .pptx

    Voja Antonic03/19/2016 at 10:51 0 comments

    My conference talk will cover the basic badge concept and some useful suggestions for badge hacking and the special badge crack.

    Here are a few slides from the presentation.

  • Infrared terminal interface

    Voja Antonic03/04/2016 at 23:50 0 comments

    Here's the infrared interface for HaD|Bg badge, which will be exibited and available during the conference. It connects with some desktop PC through RS-232 port, and converts bidirectional serial data signals to infrared, modulated with 40 KHz carrier. There are LEDs which display the current status: red eyes blink each time when it receives bytes from the badge, and the blue hat blinks when PC transmits data via infrared LED.

    It will have two functions on the 04.09 happening:

    First, everybody will be able to express themselves by entering the name or some other ASCII message in the serial terminal via keyboard, and transfering it to the badge. As the badge is equipped with moving message function, we shall have a hundreds of messages running around.

    Second, if you intend to employ the infrared TX/RX during the software hacking workshop, you will be able to test the parts of the program by simply communicating with the desktopćs terminal

    In case you wonder about the unusual PCB design - its the leftover of the old project, now equipped with one PIC18F2220 (in the original version, there were two MCUs, but the lower one is empty now). Microcontroller is not too busy - it only generates 40KHz carrier and generates timings for LED blinking during RX or TX. The signal actually doesn't pass through the MCU.

  • Badge + Accelerometer = Fun

    Voja Antonic02/28/2016 at 13:25 0 comments

    Here's the last minute modification on the badge PCB: now it has a place for accelerometer ADXL345 or gyroscope/accelerometer GY-521 module. This is a simple demo:

    A lot of Arduino guys know those small modules, they are easy to find and relatively inexpensive (about 3 € here). Here's the screenshot of the final PCB version. The place for accelerometer can also serve as the prototyping/hacking area.

    I was experimenting a little with those two accelerometers. First I made the service subroutine, which emulates I2C port by software, and now it can even autodetect the accelerometer type. But my opinion is that GY-521 works much better. I have three ADXL345 modules, and all of them have such a strong noise that 3 or 4 low bits can't be used for anything useful. So, my advice is GY-521. It is about 0.5€ more expensive, but it is not only more stable, but also has gyroscope and temperature sensor.

  • UART data via infrared

    Voja Antonic02/07/2016 at 23:13 2 comments

    There are several modifications on PCB layout: Anode drivers are not so disorderly scattered over ports A and C - now they are arranged in proper order over port A only. Sink driver SCT2024 outputs are arranged in the similar way. Also, USB mini-A connector is replaced by micro-B, which is much more common today (thanks, @Tom).

    My favorite upgrade is based on one schottky diode D3, which enables semi-duplex serial communication over 940 nm infrared channel. In the first version, there was IR LED and IR receiver TSOP6240TTCD, with contains photodetector, AGC preamplifier, 40KHz band-pass filter and demodulator. You were supposed to apply PCM signal to infrared LED and to pick data by the receiver at the other side, but it consumes 100% of processor time and disables LED multiplex refreshing. But if you use UART to transmit and receive data, you will have the undisturbed display all the time.

    The only problem is how to apply 40KHz carrier to infrared LED. You could use external AND gate to do so, but it is much simpler to use the diode which modulates the driver. This carrier can be permanently generated by Output Compare Module, so the complete communication is obtained using internal MCU peripherals.

    With such a low carrier frequency, you can not obtain too high data rate - don't even try (at least with TSOP family) to get more than 600 Baud, which is 60 bytes/sec. But this is a small MCU, with very limited data memory, so you are not supposed to transfer megabytes of data. You will probably transmit and receive some short text for moving message display or your business card details, so one of two seconds will be enough.

    I was experimenting a little, and results are quite satisfactory. It is very easy to obtain the good data transfer in one room, even when transmitter and receiver do not 'see' each other, especially if the walls are white.

View all 5 project logs

Enjoy this project?

Share

Discussions

Jovan wrote 04/09/2016 at 22:37 point

a pity that badge doesn't use ESP8266 or Arduino...

  Are you sure? yes | no

davedarko wrote 04/09/2016 at 22:48 point

is this blog sarkasm or do you mean that? :)

  Are you sure? yes | no

mike wrote 04/06/2016 at 22:21 point

Can you explain these lines in the bootloader  - why are these jumping to addresses different to the normal ISR addresses in the offset application code?

#define REMAPPED_APPLICATION_HIGH_ISR_VECTOR    0x1800    // not 0x1808 anymore
#define REMAPPED_APPLICATION_LOW_ISR_VECTOR     0x1806    // not 0x1818 anymore

  Are you sure? yes | no

Voja Antonic wrote 04/06/2016 at 22:27 point

The only normal addresses are 0x0008 and 0x0018. In the offset application code you have to remap them, so any address >=0x1800 is good enough.

  Are you sure? yes | no

mike wrote 04/06/2016 at 22:39 point

But if you write a C application, and offset the start address to 0x1800 in the linker, the reset code will be at 0x1800 and interrupt code will be at 0x1808 and 0x1818 by default, so an interrupt will jump to the reset code in the application. You'd need to mess about with the compiler or linker settings to make it work correctly.

Why does the bootloader not use the standard addresses?

  Are you sure? yes | no

Voja Antonic wrote 04/06/2016 at 22:46 point

Sorry, you have to redefine them. Please refer to https://github.com/Hack-a-Day/hackaday-belgrade-badge-MPLABX for preconfigured MPLABX framework.

  Are you sure? yes | no

mike wrote 04/06/2016 at 23:10 point

Thinking about it, I can patch it up by offsetting the C code to  0x1820 and putting some jumps from 1800,1806 and the reset vector at 180C. 

Won't be using the kernel - I have my own display code ;-)

  Are you sure? yes | no

mike wrote 04/04/2016 at 18:38 point

The schematic doesn't seem to have been updated to match the last PCB that was posted, in particular display driver to sclk on pin 22, not 24 as shown in schematic - which is correct ?

  Are you sure? yes | no

Voja Antonic wrote 04/04/2016 at 19:00 point

Corrected. Thanks!

  Are you sure? yes | no

mike wrote 03/19/2016 at 09:05 point

Is that the final PCB layout ? Will the accelerometer/gyro be fitted - you just mention a position for one - if so which one? ( and don't forget to update the schematic!) 

How will your display driver code be integrated - will it be included in the bootloader or supplied as a seperate module to integrate with user apps?

  Are you sure? yes | no

Voja Antonic wrote 03/19/2016 at 11:13 point

Yes, Mike, that's the final PCB layout. Accelerometer pads match both GY521 and ADXL345, depended on how you turn it. Kernel software will autodetect which one is present.

Accelerometer modules is not a part of the badge, so you should bring one and solder it at the workshop if you wish. The hacking area contains 8×6 general purpose pads, and accelerometer is one of ways to use it.

I strongly recommend GY521, as ADXL345 delivers a lot of noise in X, Y and Z readings, especially when the battery is exhausted.

Display driver code (and keyboard debouncer and pause/sleep service) are not a part of bootloader, but the independent kernel code. There is the third code also, which is linked with kernel, it contains display demo, Tetris game and the simulation which employs accelerometer.

Please note that the USB connector type was changed, it is not MINI but MICRO-B.

  Are you sure? yes | no

Voja Antonic wrote 04/01/2016 at 21:26 point

Update: Kernel is now the integral part of Bootloader pack, and will be resident in Program Memory. Details are in PDF file, in FILES page.

  Are you sure? yes | no

Ted Mieske wrote 02/17/2016 at 23:21 point

Where can I buy the board, Microchip, and get the code?

  Are you sure? yes | no

Voja Antonic wrote 02/17/2016 at 23:33 point

Sorry Ted, there will be no sale. The badge is for conference visitors only. All files (source code, PCB project, layout and bootloader support) will be posted here (in FILES window) and on Github, as soon as it gets finally defined.

  Are you sure? yes | no

Ted Mieske wrote 02/17/2016 at 23:49 point

OK, thanks anyway...

  Are you sure? yes | no

Mike Harrison wrote 02/13/2016 at 19:43 point

There's some scope for BOM reduction - R1,3,4 can all be 22K, R6 can probably be 150. And do you really need resistors on the FET gates? They only have ~200pf gate capacitance so 150R isn't going to be doing much. 

  Are you sure? yes | no

Voja Antonic wrote 02/13/2016 at 20:49 point

Actually, R3 and R4 are not necessary at all (there are internal pull-ups), but the PCB is open to fingers and moisture and I want to lower the possibility of false triggering on critical inputs. But you gave me the idea to lower R1/R2 attenuator resistance and to make all of them 10K. By the way, 10K on MCLR is Microchip's datasheet value, and R6=100R is Vishay's typical value (and Vs is close to its minimum). I frequently modify those values in my own designs, but not in public projects.

The very first prototypes (which I also sent to Mike and Alek) were without gate resistors, but then I've got the suggestion from someone... maybe it's better to keep going my own intuition? At last, my choice is FDY102PZ, which has only 100pF input capacitance, which made me to do the final redesign of the PCB yesterday, and now it is without gate resistors again. Additionally, FDY102PZ is significantly cheaper, and has the built-in input protection Zener.

Thanks!

  Are you sure? yes | no

Mike Harrison wrote 02/13/2016 at 23:55 point

You only really need gate resistors when you're using much bigger MOSFETs (switching many amps), to avoid current spikes and read-before-write issues with bit instructions due to multiple nF gate capacitance.Or if you want to control edge rates, in which case you'd be looking at values more like 10K. 
No need for them in this application

  Are you sure? yes | no

Kumar, Abhishek wrote 02/06/2016 at 09:08 point

I'm interested to know what schematic/layout software you used.

  Are you sure? yes | no

Voja Antonic wrote 02/06/2016 at 09:11 point

CorelDraw for schematic, Protel Client98 for PCB layout

  Are you sure? yes | no

ZaidPirwani wrote 02/17/2016 at 14:52 point

you must have all sorts of components ready to use in CorelDraw...!

  Are you sure? yes | no

Mike Harrison wrote 02/05/2016 at 23:29 point

Pity the display driver isn't connected to the SPI/MSSP port for faster update. May need to bring my soldering iron for what I have in  mind....

What will the config word be set to , in particular the oscillator config?

What's the R5 connection for - just a simple way to flash 1 LED?

  Are you sure? yes | no

Voja Antonic wrote 02/06/2016 at 00:41 point

Soldering iron is always welcome, but SPI is of little use here. Frame buffer is 8 bits wide and 16 bytes high (for more convenient way of defining images in memory), and the matrix is refreshed column by column. So if you use SPI, you would have to extract somehow one by one bit from 16 bytes... in two steps, I guess, as 25K50 has 8-bit SPI interface. Another reason is that you can have better trace placement (and better design rule, which means wider traces and less vias), as you don't have to respect output bits order.

FOSC=INTOSCIO, LS48MHZ=SYS48X8, LS48MHZ=SYS48X8, PLLSEL=PLL3X. As you can see, it is adjusted for internal oscillator and USB interface.

Good guess, R5 flashes one LED during USB communication, as the multiplex is off in USB bootloader mode.

  Are you sure? yes | no

Mike Harrison wrote 02/06/2016 at 01:01 point

I suppose it depends what you want to achieve - if, for example you want to do something like, say, more than one bit per pixel, SPI can make a big difference ;-)

Oh, and having access to the driver's OE pin can also be very handy...

  Are you sure? yes | no

Voja Antonic wrote 02/06/2016 at 01:50 point

Yes, SPI can be helpful in some other frame buffer configuration.

I agree, OE might be handy if you drive it with ECCP output. Maybe it would pay off to sacrifice AUX port for that?

  Are you sure? yes | no

Voja Antonic wrote 02/20/2016 at 17:54 point

Sorry, I was wrong here. I was confused with some other MCU family and for the whole time I thought that SCK and SDO share pins with TXD and RXD (like CK and DT). Now I see that they don't share RC6 and RC7 but RB1 and RB3, so I modified it and you will have your SPI port on SCT2024.

You were right. Thanks.

  Are you sure? yes | no

Tom wrote 02/05/2016 at 22:06 point

Why a mini-USB connector while the whole world has switched to micro USB? You can't even get devices with a mini-USB connector certified.

Added benefit is that at least half of the people are carrying a micro USB cable for charging their phones/yablets/etc anyway.

  Are you sure? yes | no

Voja Antonic wrote 02/06/2016 at 00:44 point

This could be something to think about. There are a few days left before PCB project deadline. Thanks.

  Are you sure? yes | no

Tom wrote 02/14/2016 at 14:29 point

Just read the project update, thanks for following my suggestion!

  Are you sure? yes | no

jaromir.sukuba wrote 02/05/2016 at 09:48 point

Perhaps the bootloader is compatible with bootloader from pinguino

http://www.pinguino.cc/

http://wiki.pinguino.cc/index.php/Basics#Bootloader

  Are you sure? yes | no

de∫hipu wrote 02/05/2016 at 09:23 point

I really hate it when people write "PC" when they really mean "Microsoft Windows". Also, free or gratis?

  Are you sure? yes | no

Voja Antonic wrote 02/05/2016 at 09:35 point

OK, then "USB HID Bootloader v2.90a for Windows at Microsoft Windows side" :)

  Are you sure? yes | no

de∫hipu wrote 02/05/2016 at 10:19 point

I meant this:

> There is the bootloader, so all you need is USB cable and bootloader software for PC, which is available and free.

and yeah, I am nitpicking. On the other hand, I don't have access to any Windows box, so I am a little bit worried that this thing will be useless to me, which is a great shame, because it really looks great!

  Are you sure? yes | no

jaromir.sukuba wrote 02/05/2016 at 19:18 point

PIC devices very similar to PIC18F25K50 are supported on this one https://hackaday.io/project/1757-pp04-camel-computer so it's definitely feasible. It's just matter of "little bit of coding". Now I realized 5 of my projects are programmers of some kind and a few programmers are still unreleased to public.

  Are you sure? yes | no

jaromir.sukuba wrote 02/05/2016 at 15:36 point

If time allows, I will add support to PIC18F25K50 to this one https://hackaday.io/project/8559-pic16f1xxx-arduino-based-programmer until the conference will take place, so you can (provided you have arduino and POSIX OS) reflash it without bootloader or use any other bootloader, not tied to "Intelindows" platform.

  Are you sure? yes | no

Voja Antonic wrote 02/05/2016 at 18:30 point

That would be great, I hope that you will find some time
Thanks, Jaromir!

  Are you sure? yes | no

de∫hipu wrote 02/05/2016 at 21:02 point

That's awesome work, thank you! Microchip should pay you!

  Are you sure? yes | no

PinheadBE wrote 02/17/2016 at 10:02 point

What would be great also, is that [Voja Antonic] would also find time to post his design files, including source code.   Because many of these projects seem to me a bit like "show-off", but not open-source at all.  So what is the goal?  

  Are you sure? yes | no

jaromir.sukuba wrote 04/01/2016 at 22:44 point

And here we go:

https://hackaday.io/project/8559-microchip-pic-arduino-based-programmer/log/35064-goals-slightly-revisited-pic18f25k50-support

Build sources with SDCC/gputils, burn binary via arduno... on your PC ;-) So, don't forget to take your arduino to conference, along with a few 1Kohm resistors.

  Are you sure? yes | no

K.C. Lee wrote 04/01/2016 at 22:55 point

The irony is that a Mac commercial refers to it. Prior to that point PC = personal computer. But when you have 90-ish% of the market, that association isn't wrong. What's wrong is the non-windows person's reaction.

  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