see the previous posts Wireless Challenge .... Beer Tap (the other bit) -3  Wireless Challenge .... the other bit -2  Wireless Challenge .... the other bit  Beyond the Phone - eLIST progress 3  eLIST progress 2 , eLIST progress , eLIST - KOBO Touch , 5W Load Schematic

 

The second part of my challenge involved changing the illumination source in a genuine Beer Tap.

While it's not 100% practical (given that the tap has a connection to the amber liquid, as well as refrigeration pipes ... a couple of wires is nothing ), it does provide a basis for altering the plain lighting, and reducing maintenance.

 

DSC_4335.JPGDSC_4339.JPG

                  Bar side or the important side                                                                                     Customer side

 

 

 

 

NeoPixels

These are a fantastic option for lighting, and are extremely bright.

As anyone who has seen this in action can attest, it is VERY BRIGHT, even at 3.x volts from a LiPo.

 

There is a limited depth, which means making the electronics as low as possible. While this has worked, a diffuser is still required, and the final brightness chosen.

I'm happy with the results, but I'm looking at making a custom board to spread the light a little more.

 

 

These will also be very useful for macro photography.

As anyone who has tried can attest, when the lens is 100mm from the subject, getting light onto the subject is a battle, and usually results in various compromises.

These are bright enough, easily controlled and can fit on a simple wire stand, while the color change gives some creativity options as well.

 

 

 

 

ATtiny85

My attempts to program the bare ATtiny85 micro-controller failed.

I tried using the Digispark as a ISP Programmer based on this http://digistump.com/wiki/digispark/tutorials/programming, but for some reason it just didn't go right for me.

In the end I used a Digispark, and elected to not worry about putting it to sleep, and use a switch.

 

Not content with plain white I did use the 'rainbow' example to allow someone to change colors.

I fitted a hall effect device behind the cover, connected to pin 3, and this triggers the color to cycle through the range.

Once you decide the color you want, remove the magnet and it stays.

 

So while its not 100% as planned, it's still based on a ATtiny85 and works fine.

 

I'll keep trying to sort out what went wrong as I have a few other projects that will be using this useful little micro.

 

 

 

 

 

Charging

When I laid out the parts, I made sure the LiPo charger was 'face down' so the leds could be seen thru the disc.

I stuck everything onto a piece of mylar, so it could be assembled and adjusted easily (and just in case I slipped with the soldering iron, and damaged the disc).

 

Obviously the demo transmitters physical size will block this, so a custom transmitter is required.

I do have one much smaller off the shelf version, and need to check the inductance to match to one of Wurths 50mm coils to it.

 

This could then be made into a very simple unit that is able to clip over the opaque disc and charge.

 


Wurth have been very kind and are sending me one of their slim charging receivers, which hopefully will fit inside and not add too much height.

I also have the option of changing the coil, since the electronics is based on the TI chip (BQ51013B).

 

Until I can confirm sizes, and distances I will wait.

 

 

Operation

When first powered it presents a white (currently at 50% brightness).

If you pass a magnet over the Hall Effect sensor, it starts cycling through the various colors.

 

I have attached a video, showing just the disc (as the office is far too messy, and the lights not suitable)

This doesn't truly represent the colors as viewed by the eye, but gives an indication of the final product.

 

 

 

 

 

 

 

Parts

The parts are shown in this picture.

 

Inside.JPG

The wiring is very simple with the QI Charger connected to the 5v and GND of the liPo charger, the battery plugged in, and the Digispark wired across the BAT and GND connection points.

The NeoPixel Din connects to P2 and the Hall Effects output connects to P3 on the Digispark.

 

 

Code

The final code is simple and uses the example software supplied with the Adafruit NeoPixel library.

 

  #include <Adafruit_NeoPixel.h>

  #define PIN 2
  const byte CHANGER = 3;

  int val =0;                 //used in the analogue pot to set brightness
  long LastButtonCheck = 0;
  int ChangeTime = 25;
  boolean Colour =0;          // used to decide if colour change is happening
  boolean ButtonState = 0;    // boolean to storelast change
  byte ButtonCount = 0;

  // Parameter 1 = number of pixels in strip
  // Parameter 2 = Arduino pin number (most are valid)
  // Parameter 3 = pixel type flags, add together as needed:
  //   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
  //   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
  //   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
  //   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
  Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);

  // IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
  // pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
  // and minimize distance between Arduino and first pixel.  Avoid connecting
  // on a live circuit...if you must, connect GND first.

  void setup() {
    strip.begin();
    strip.show(); // Initialize all pixels to 'off'
    pinMode (CHANGER, INPUT);
    digitalWrite (CHANGER, HIGH);  // internal pull-up
    for (int i=0; i<12; i++)
    {
      strip.setPixelColor(i, 255, 255, 255);  //initially white
      strip.show();
    }
  }

  void loop() {
    // Some example procedures showing how to display to the pixels:

    Check_Buttons();
  
    if (Colour == 1)
    {
      rainbow(40);
    }
    else
    {
      // stay doing nothing
    }

    strip.setBrightness(50);
    strip.show();
  }


void Check_Buttons()

  /* This routine checks the timer (LastButtonCheck) and if necessary reads the button input
     If the button is detected, it waits unitl it counts it 10 times at the set time rate.
     This prevents button bounce from triggering and ensures the button is pressed.
  
     Once a valid button press has been detected, it starts a timer (ButtonPressTime),
   
  */
    {
      if (millis() - LastButtonCheck > 5)                    // Reads button state every 5mS and then updates button counts
      {    
        ButtonState = digitalRead(CHANGER);
        LastButtonCheck = millis();
     
        if (ButtonState == LOW)
        {
          ButtonCount ++;                                     // Increment the Count by 1
          if (ButtonCount > 5)                               // the button should be LOW for 5x5mS = 25mS
          {
            // Button has been pressed for longer than 100mS so its valid
             ButtonCount = 0;
            Colour =1;                                      // Do something with the valid button press
          }
        }
        else                                                  // Button is HIGH
        {
          ButtonCount =0;                                     // Reset the counter as the button has been released
          Colour =0;
        }
      }
    }
   

  // The user wishes to change colour
void rainbow(uint8_t wait) {
  Check_Buttons();
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++)
    {
      strip.setPixelColor(i, Wheel((i+j) & 255));

    }
    strip.show();
    Check_Buttons();
    delay(wait);
      if (Colour == 0)
      {
        break;      //get out
      }
  }
}

uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}



 

 

Conclusions

I've had fun with this challenge.

It's given me an insight into some possible uses for the technology, which I have suggested to a group of Year 8 (12/13 yr olds) who are doing a "Technology to assist the Elderly" project.

 

Thanks to our sponsors.

Have fun, drink sensibly and if you wish to vote the poll is here Community Choice - Beyond the Phone Challenge

 

Mark

edit

Link to the next part  Beyond the Phone - eLIST progress 5 (Webserver)