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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Legacy Personal Blogs The Light up NFC Bracelet: Stage 3
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: charlotte_godley
  • Date Created: 16 Jun 2015 10:20 PM Date Created
  • Views 1195 views
  • Likes 3 likes
  • Comments 2 comments
  • nfcrfidch
  • neopixel
  • charlotte_godley
  • adafruit_gemma
  • circuits_with_charlotte
  • adafruit
Related
Recommended

The Light up NFC Bracelet: Stage 3

charlotte_godley
charlotte_godley
16 Jun 2015

This is the third and final step of producing a GEMMA bracelet which can have its LED pattern programmed using an NFC capable phone.

In the previous 2 stages, I talked about putting together the hardware and producing an app which would communicate with the bracelet from the phone. Now we need to tie the two ends together.

 

Step 1

The first step is to produce a dummy or fake input and have the GEMMA process it and play the relevant pattern on the LEDs. To do this we'll set up a new sketch and a string which will be the dummy input:

 

Here we have a method which takes a string of input and a number of LEDs. It will then take each colour and number of seconds, turn the LEDs on in sequence and turn them off again according to the seconds you've given it.

Let's put this to the test and upload it to the GEMMA. You should see each one light up according to the colour and time you've put in. Each LED has 8 letters in the string - the first 6 represent a hexadecimal number which gives the LED its colour - if you google "colour picker" most online colour picking tools will provide you with this. It's also provided in the app we created in phase 2. The second 2 are the number of seconds the light will be on before being switched off.

 

Step 2

Now that we have a processing section, we need to pull in the actual input from the NFC antenna connected to the GEMMA. We're going to use the default library for ATTiny85 processors called TinyWire. In order to make the antenna work with this project, though, we need to modify it, so let's download the library from Github and open up TinyWireM.h.

Find the line beginning

#define USI_BUF_SIZE

This buffer needs changing so that it can handle at minimum 12 bits. On top of this, the buffer needs to be able to handle the maximum number of characters in your NFC text string. So, if you have 3 LEDs, you need 12 + 3 x 8 = 36.

 

Step 3

Now let's actually implement TinyWire. Import it into the sketch. According to the M24SR documentation, this is the sequence along with the commands we need to send the NFC antenna in order to get the relevant data back:

select I2C:

SEND: [AC] 0x52

 

select NFC application

SEND: [AC] 0x2 0x0 0xa4 0x4 0x0 0x7 0xd2 0x76 0x0 0x0 0x85 0x1 0x1 0x0 0x35 0xc0

 

select CC file:

SEND: [AC] 0x3 0x0 0xa4 0x0 0xc 0x2 0xe1 0x3 0xd2 0xaf

 

read CC file length:

SEND: [AC] 0x2 0x0 0xb0 0x0 0x0 0x2 0x6b 0x7d

 

read CC file:

SEND: [AC] 0x3 0x0 0xb0 0x0 0x0 0xf 0xa5 0xa2

 

select NDEF file:

SEND: [AC] 0x2 0x0 0xa4 0x0 0xc 0x2 0x0 0x1 0x3e 0xfd

 

read NDEF message length:

SEND: [AC] 0x3 0x0 0xb0 0x0 0x0 0x2 0x40 0x79

 

read NDEF message

SEND: [AC] 0x2 0x0 0xb0 0x0 0x2 0x14 0x6c 0x3b

 

deselect

SEND: [AC] 0xc2 0xe0 0xb4

 

I2C essentially works by sending a command down the wire and handling the response, so essentially we just need to send each command and process the response in order, then when we get the final "message" from the antenna's stored memory, send that to the method we made earlier. Here's the full sketch including the output code:

 

A big thank you and round of applause to David Whale, AKA Whaleygeek for writing the vast majority of this part of the code. I had a degree to complete at the time of writing, so I unfortunately couldn't dedicate enough time to the project to write and test the code. The full repo of David's work can be found here on Github, including work to connect the NFC antenna with a Raspberry Pi.

 

You can check out the video of this here. Let me know if you have any new ideas for where we can take this project!

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

  • Sign in to reply
  • Former Member
    Former Member over 9 years ago

    Hey!
    I registered just to post this; just wanted to say well done.  Thought your design is lovely (esp. for a first prototype!)...an the idea is exactly where I'm headed with a few things...allbeit I'm nowhere near the soldering and coding stage yet...

     

    Ideas where you could go with this:

     

    1) Add haptic feedback (e.g a vibration unit, or linear actuator like the Apple Watch has) to "pulse" with the lights...
    2) Alerts - e.g a single red flash if you get an email on your phone from someone on your VIP list...or blue if you get a tweet mentioning you...green if you've got an alarm set etc.  I'm sure you've already though of these ideas...
    3) Customised colour patterns based on who is phoning/texting you.
    4) Used in conjunction with a heart sensor (from a fib or smart watch etc.) to show your heart-rate...or other biometrics like linked to a blood-sugar sensor so it tells you if your blood-sugar is dropping.
    5) Used in location-specific examples...handed out in a night-club to be used to attract certain types of people etc. (e.g. if you're a green, you are interesting in seeing someone that evening...if you're a blue, you're looking for a seriouss relationship..if you're red you're not interested etc.)

    6 Another location-specific example, tied to the NFC tag...not sure how you'd implement it, but when you're trying to find the right room in a hotel, or office in a building...or maybe in a large superstore like IKEA, and you're looking for the kitchens department....device directs you to the right place/room by changing colour (interacting with NFC tags placed everywhere in the building)...

     

     

     

    Just a few rubbish ideas....love your design tho...and it could be made to look so pretty...like tiny gems...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 10 years ago

    Hi Charlotte,

    Kudos on your project....its really really interesting..!!

    I am doing a similar school project in which instead of the Gemma..I am using a neopixel shield.

    and instead of a cellphone with NFC reader, I am using a Mifare sticker with NFC shield+ arduino UNO.

    I was wondering if you could help me out with the sketch or direct me to someone who can help me write a sketch converting the NFC input to Neopixel shield output.
    It would also be great if you could share some links which you might have come across of projects on similar lines..


    Neway....congrats again for the wonderful project


    Chao,

    Indrajeet

    indrajeet.kb@gmail.com

    • 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