Friday, April 25, 2014

Wearable Electronics: Arduino X ATTiny85 with WS2812/2811 addressable RGB LED strip

Wearable Electronics: Arduino ISP ATTiny85 with WS2812/2811 addressable RGB LED strip
Many moons earlier, Mr.ChongSP ordered some individually addressable RGB LED strip (60LED/m) that uses WS2812 from middle country: aliexpress. Adafruit has a similar product, the Adafruit Neopixel. Yours truly manage to “BBS” 1x courtesy of Mr.ChongSP. Hardware is easy to procure, but “free” time to play with this new toy is hard to come by. Yours truly is working to the tune of “The Beatles-eight days a week” for the last couple of months. Nonetheless, when responsibility comes (to appear alongside Mr.JolyonC on stage for the Freshman Orientation Program “From Faraday to Fusion”), there is a need to push out the boat. The thing supposed to be a stage piece to grab freshie’s attention, so, addressable RGB LED on a jacket it shall be.

Since it is a wearable, there are several design (engineering) considerations. First, the Power supply unit, to power both the microcontroller (MCU) and the RGB LED Strip. Secondly, the size of the electronics package and thirdly, diffuser for RGB LED strip.
Using Arduino is a popular choice, given the footprint of it, it is easy to spot from a far. Not a good design choice. Furthermore, Arduino requires 9V supply whereas WS2812/2811 addressable RGB LED strip requires 5V. If both are used together, there is a need for a separate circuitry with both 7895 5v and 7809 9v voltage regulators, with supply being 12V 1A. Having said that, 12V battery pack and voltage regulator circuitry increase the footprint of the total package.
Therefore, the logical choice would be ATTiny85 that can be powered off from a 3to6V battery; PSU is a 5V 1A mobile power bank with USB connector that is meant for charging smart phones on the go. The choice of this PSU can be used to power both the addressable RGB strip and also ATTiny85.
As for the diffuser, 3D printed spikes using ninjaflex !
Parts needed
1x Arduino as the In System Programmer (ISP); detail guide here
1x ATTiny85 break out board of choice; using custom MitG PCB
1x ATTiny85
1x WS2812/2811 addressable RGB LED strip (it can be neopixel from adafruit, or pseudo neopixel from middle country:aliexpress)
Courtesy of the techno arsenal available to SP MAKERS CLUB, all of the parts listed above are available, as per display in the image above.
Setting up the software environment
Although the RGB LED strips on hand are not Adafruit Neopixel, thanks to the Adafruit neopixel code library released on github , it really saves a lot of time and effort by not re-inventing the wheel.
The “now” trend of selling a product over the Internet: In order to increase ownership from non-techines, the manufacturers will produce very detail idiot proof step by step guide. In neopixel example, the UBERGUIDE is definitely very useful. In the hands of a techie, it became some sort of cheat code, using it far from the intended purpose.
Thus, follow the UBERGUIDE (URL is in references section at the bottom of this post) closely to setup the software environment.
Setting up the hardware
Wiring is dead easy. Data pin from the addressable RGB LED strip to pin of your choice. In this case, digital pin4 of ATTiny85. NOTE: must ensure common ground by connecting ground wire of RGB LED strip to ground pin of MCU.
Programming the hardware
First, ensure all the hardware are setup accordingly to the tutorial earlier. E.g ATTiny85 on the ISP shield, ISP shield on the Arduino. USB cable is plugged in, and drivers are installed for Arduino.
Set the “programmer” to Arduino as ISP, as depicted in the image above.
Set the “board” to ATtiny85 8MHz. Rule of thumb, choose 1MHz if low energy consumption is required, the downside, computation speed of the code will be affected. 20MHz option will not work out of the box, this option requires an external oscillator as the clock.
Set the “Serial Port” to the one detected on your computer.  
Double check the “parameters” on the lower right hand corner as depicted in the image above.
Everything seems to be prim and rosy. But we are not done yet.
If ATTiny85 is new out of the box, need to do the following step to burn the “bootloader”. Otherwise the code will be compiled, downloaded accordingly, but could not start the program upon reset.
Else, the above can be skip if the ATTiny has been programmed at 8Mhz.
Source code is in public domain using the following URL
Now, click the upload button! Fingers crossed if it pleases you.
Plug in the USB power bank to test.
Wearable electronics = WS2812/2811 RGB LED strip+ ninjaFlex + ATTiny85 + Arduino + USB Mobile Power Bank + visibility vest

ATTinyXX MCU has very small memory footprint; having a code footprint that is above 4k will trigger an error “relocation truncated to fit: R_AVR_13_PCREL”. Use the patch and description of the error from the following URL to fix this error

Friday, April 18, 2014

3D printing using NinjaFlex with Makerbot Replicator2 and RepRap Prusa Mendel i3 Durbie v2

3D printing using NinjaFlex with Makerbot Replicator2 and RepRap Prusa Mendel i3 Durbie v2

Earlier in February, yours truly came across an exciting new type of 3D printing filament that is flexible, stretchable, thus allows for many creative creations. Say farewell to the rigidity of PLA and ABS! Without hesitance, yours truly ordered a spool of 1.75mm white filament with a local vendor (probably the first spool brought in here) at SGD100 per pop.
May I present to you, the NinjaFlex by Fennel Drives .
Finally over the last few days, yours truly manage to find some time to play with this excellent new type of filament. Prior to commit, it is best to read the manufacturer’s website and adafruit’s tutorial, and by following the recommended best practices for 3D printing with this NinjaFlex should be a breeze. Technically I summarized from the reading materials, if I followed the recommended extruder temperature of 215degC, non heated bed, and blue tape on the printing bed; it is going to be minimal effort to install the NinjaFlex and we can have a lot of creative fun happening here at FabLab@SP.
Sorry to throw in the wet blanket. The experiment with NinjaFlex is not a breeze, even with the prior knowledge well versed; hence there is a need to raise some awareness and share some experience on how to get it right (or way wrong) with NinjaFlex. Courtesy of FabLab@SP, yours truly has the luxury of tens of makerbot replicator2 at his disposal, and a well-stocked personal arsenal; you guess what, it consist of a 3D printer the RepRap Prusa Mendel i3 Durbie v2
Few important parameters that decide the success rate of 3D printing with NinjaFlex: filament feeder mechanism (FFM), extruder hot end (EHE) temperature, heated printer bed (HPB) temperature, type of tape used on printer bed, and extruder extruding speed (EES). Gathering from the reading material over the Internet, NinjaFlex has a specific operating temperature; users reported success with EHE set at 215 to 225 degC, and HPB set at 30 to 50degC. The filament is flexible and stretchable, sticks well to kapton tape; others reported success on blue tape, scotch tape, and acrylic. However, due to the partiality of info provided by various users that reported success, it is difficult to replicate their success at our end.
Hence yours truly has done several A/B test for NinjaFlex on both makerbot replicator2 and reprap, and varying the parameters.
Experiment1: NinjaFlex 3D printing with Makerbot replicator2 using modified MK2 FFM, non HPB, blue tape on printer bed.
All the makerbot replicator2 in FabLab@SP are modified with spring loaded FFM, as depicted in the picture above. Spring loaded FFM is the must have to print NinjaFlex on makerbot replicator. All parameters such as EHE at 218degC, non HPB, blue-tape on printer bed, EES at 40mm/s are held constant. On first try or maybe it is beginner’s luck, NinjaFlex is loaded successfully, FFM is feeding NinjaFlex with no qualms during loading phase. Next, when it comes to 3D printing with NinjaFlex, the material refuses to stick on the existing printer bed with blue tape, thus excess material clogged the nozzle. Subsequent tries to print, no material is oozing from the nozzle. So, carry out the SOP of unloading the filament, and then clear any material that clog the hot end or drive gear chamber. The next many hours to reload the NinjaFlex are frustrating. First of all, the filament itself is limp, lack the stiffness of PLA, thus it is becoming increasingly difficult to fish the filament through the guide hole. Even though the filament is fished properly through the guide hole, but no material is extruded through the nozzle. The filament is fed continuously in the whole process alright, but somehow, nothing is extruded. Open up the extruder to check for any jammed material at the hole entering the hot end, nothing. So basically the couple of hours are spent on repetitive cycle trying to load the NinjaFlex. The next logical step is to observe ninjaflex filament feeding into the extruder without the heat sink and fan. Surprise!! The filament is winding up in the drive gear. So to conclude this experiment: ninjaflex does not stick to blue tape, filament is too limp to be fed 100% correctly.
Experiment2: NinjaFlex 3D printing with RepRap Prusa Mendel i3 Durbie v2, HPB, kapton tape on printer bed.
All parameters such as EHE at 218degC, HPB at 40degC, kapton tape on printer bed, EES at 40mm/s are held constant.
Due to the design of the geared extruder, loading the limp filament is a breeze compared to makerbot replicator2. All need to be done basically to loosen the 2 spring loaded screws, manually fish the filament through the guide holes and also into the hot end, tighten the screws and then extrude filament to check for proper feed.
On the first try to print, the ninjaflex did sticks very well indeed to kapton tape. Besides kapton tape, subsequent tries on HPB’s glass plate but without kapton tape sticks well too.
3D Printing win NinjaFlex using RepRap went well. All is left is to fine tune the parameters to achieve the ideal result. Cone on the right is first try, left is second try.
Once the 3D printing parameters are tune with confidence, try it on a bigger print job to check whether 3D printing NinjaFlex with RepRap lives up to it’s reputation. The parameters used are EHE at 220degC, HPB at 40degC, kapton tape on printer bed, EES at 20mm/s. The following parameter is peculiar only to slic3r for ninjaFlex: Fill pattern rectilinear, Infill 50%, 3 shells, 4 skirt loops, layer height 0.2mm,
The first few layers printed according to expectations, however, half way through a 3hour print job of a note3 bumper, the ninjaflex filament is not feeding and starts to air printing. After a few tries with the smaller test prints, apparently the nozzle clogs at random layers and hence air printing too.
While issuing a new test prints, out of sudden the reprap is not printing and pronterface can’t connect to the reprap. First, the ninjaflex is working only to air print randomly, then the reprap stop responding. The experimentation with NinjaFlex on reprap can’t be continued, until the issue with RepRap is resolved. What a bad day to do experiment. The semi conclusion will be NinjaFlex sticks well to kapton (and also glass panel tested before the RepRap went cold), printing with RepRap is a breeze; but need to resolve the air printing.
Experiment3: NinjaFlex 3D printing with Makerbot replicator2 using modified flexMK8 FFM, non HPB, blue tape on half of printer bed, and the other half is clear acrylic.
For experiment1, the suggestion is to find a better spring loaded FFM that ensures 100% chance of feeding the NinjaFlex into the hot end of the extruder. There is ready solution for open source printers, such as the lulzbot flexystruder tailored specifically for NinjaFlex type of filaments. However, not suitable for makerbot replicator2. I guess the good people at fennel drives are serious about their ninjaflex product, reads about the user comment on Internet and thus uploaded a FFM mod
This mod is very easy to install. Simply print out on the existing 3D printer, let it cool by turning off the power supply, and disassemble the existing FFM to be replaced with the flexMK8.
Loading of the NinjaFlex into Makerbot replicator2 could have been easier!!! It takes only a single try to load!
The parameters used are EHE at 220degC, non HPB, EES at 20mm/s. The following parameter is peculiar only to makerware for ninjaFlex: Infill 10%, 2 shells, layer height 0.2mm. As for the test print, see for yourself.
As suspected, NinjaFlex sticks better on clear acrylic than blue tape on printer bed.
Confidence are built upon many unsuccessful experiments. The first big print job that takes 4 hours to complete with NinjaFlex.
Of course, the experiment with NinjaFlex comes complete with the adafruit cyberpunk spikes

Concluding experiment3: use flexMk8 with makerbot replicator2 for a successful loading, as for the parameters used are EHE at 220degC, non HPB, EES at 20mm/s. The following parameter is peculiar only to makerware for ninjaFlex: Infill 10%, 2 shells, layer height 0.2mm.
Outstanding task: fix the RepRap and then continue to find the best parameter to print NinjaFlex.

Saturday, April 12, 2014

\m/ rock on rave helmet for electric run, electro dance music

\m/ rock on rave helmet
Sick of generic off the shelf item for events such as electric run or electro dance music festival????
Make an customized item!
Earlier, I have devised a wirelessly charged RGB LED fiber optic bangle for the missus. She is going to be my pacer, thus when we go for a run and assumed we run close enough to each other, there will be LIGHT.  Just come to realised I have no missus, and the bangle size was not designed for a bloke, I had it shelved. Therefore I devised this helmet specifically for the events above. This rave item is sort of a motivation factor for yours truly the fatty bom bom to flex some muscle besides juicing the grey matter. I am also partially motivated after seeing Natalina’s Fiber optic dress; it is incomplete without a blinking rave head gear of some sort. 

Bills of material
1. Programmable RGB LED light source of some sort using an MCU. I have used my custom PCB for RGB LED to use with ATTiny85. Details of designing the PCB is available here, close up of the assembly of the contraction is available at my earlier instructables.
2. Light Diffuser of some sort. I have devised and 3D printed a \m/ rock on insignia in natural PLA with 5% fill and 2shells.
3. Side glow fiber optic cables.
4. Helmet.
Acquire the components and decide on how to route the fiber optics and measure the length needed. Assemble the programmable RGB LED light source PCB. The final assembly should look something similar to the following pictures. I have some surplus through hole LED diffuser lying around, so I have repurposed them to hold the RGB LEDs.
3D printed a \m/ rock on insignia in natural PLA with 5% fill and 2shells. The 3D model of \m/ rock on is uploaded to thingiverse. Feel free to download. Assemble the contraption as per the following picture. Insert the 5mm fiber optic cables and it should fit snugly.
Program the MCU. In this case, it is an ATTiny85.  The public domain RGB LED spectrum fading source code is available here.  
Fingers crossed. Plug in a 6v supply. Igor, PULL THE SWITCH!!!

A video will follow later once I find a human willing to wear it. I find it very difficult to take a selfie with my overgrown smart phone while wearing my new contraption.
Wearing my new rave helmet, I was prancing to the venue for electric run but only to realized it is an paid event. I thought it is FREE.... silly me. From public domain info, apparently early birds that book the run enjoy a huge discount as compared to late bird like me that try to sign up late. So, I decide to keep the cash for some Mackey Ds’ and continue to be a fatty bom bom.

Saturday, April 5, 2014

Repurpose old hard disk as centrifuge

Repurpose old hard disk as centrifuge
Sambal, one of my favourite condiment; technically, it goes well with ANYTHING. Did I said ANYTHING?! YES, ANYTHING! Not surprisingly, in the cold, wet, and miserable winter in London; the thought of having sambal served over nasi lemak lingers. But the exorbitant price of 12quid per pathetic serving at a nearby stall really puts me off. It is the state of the mind when it is to overcome hunger and bad weather.
Usually, sambal is prepared in big quantities and distributed to the family members. Having been familiarized with the tedious operation of preparing sambal and the amount of oil used, I do wonder if the oil content in a sambal is removed one way or the other, will it still taste the same? Several ways I have experimented. The most classic method is to let the sambal sit for several hours, until a layer of oil surfaced and then siphoned off. Being the geek one, I wonder if having sambal applied with centrifugal force to separate the solid from the liquid; does it matters at all to the taste, texture, and most importantly to the health conscious ones.  
Knowing that I have a zero chance of getting my paws on a centrifuge without cutting the red tape and overcome the bureaucracy, I have decided to make one myself. Having considered the relationship between the materials to be separated react differently to the amount of time, RPM, centrifugal force applied to it; I need a mechanism that spins at high RPM, and a mechanism to computerized the parameters to be applied to the centrifuge. So I started by making the mechanism that spins, just for the instant gratification of looking at something that spins. The computerized portion, I have thoughts of using an optical encoder to calculate the RPM, and an ESC motor controller to regulate the RPM, and also a computerized timer. This make will come at a stage after the spinning mechanism is done.
Bill of Materials: You will need the following to make a mechanism that spins at high RPM.
  1. Unloved old hard disk drive. I am using WD400EB.
  2. Custom Laser cut acrylic disk to fit the spindle of the hard drive
  3. Custom laser cut acrylic hub to fit an eppendorf or two
Having the long history of extracting rare earth magnets from many hard disks from different manufacturer; I find the WD400EB is the easiest to dismantle. My criterion of a good to dismantle hard disk is as follow: no quirky proprietary screws, no screws secured with torque that a human powered muscle cannot handled, and simplistic “clam shell” design.
WD400EB with innards removed. Note the M2 screw size used on the spindle is arranged at 60degrees a part, relatively to the spinning axis.
First iteration of the custom laser cut acrylic disk to determine the right fit. The exact measurements of the screw size, the location of the screws, the diameter of the disk, and the location to place the hub need to be determined. The diameter of the disk is 90mm, 6x M2 screws positioned at 60 degrees apart relatively to the axis.
This the following diagram with the exact measurement is sent to the laser cutter to be cut on 3mm thick acrylic. Thanks to my kaki asri and syazwan for manning the laser cutting!
Subsequent iteration of custom laser cut disk and hub to secure 4 eppendorf is assembled on the hard disk.
Spin baby spin!!!
Till last Friday end of office hours I can’t get my hands on an Eppendorf to carry out the sambal experiment. So I decided to pull a scrambled egg prank on the missus (yeah, I know april fools day is over few days ago). I would devise a contraction to spin an egg in the shell at 5400RPM. the content inside of the egg will be scrambled after subjecting to centrifugal force. Put that egg back into the fridge at the exact location where she will take an egg to make a sunny side up the next morning. Then, SURPRISED!!! I did have the thought of scrambled all the eggs in the fridge, but egg omelette, egg custard,  chawanmushi for the next few days?! no way!
This is how an undisturbed egg looks like under LED light. Once the egg is applied with centrifugal force, the content will be cloudy because the content is scrambled.
The egg does not fit the Eppendorf hub snugly; hence need a contraction of some sort to hold it in place.
After some design considerations, it is best to secure the egg in a plastic bag for insurance. The cable ties are meant to hold the egg in position.
When doing at experiment, it is very important to consider all the safety aspects; especially on the issue of failed experiment due to the malfunction of test equipment. In the case of dislodged parts at high RPM with respectable amount of centrifugal force, the projectile can be deadly. I have used one of my ex-project’s container turned upside down to contain any possible projectile and splatter. Of course, the material strength of the container need to be proportionate to the force going to be applied. I would definitely use my 20mm thick polycarbonate container if it is available, but it was discarded as junk when i was away.
Fingers crossed and let’s get started!!! Igor, pull the switch !!!!!!!!!!!
The aftermath of spinning at 5400RPM…. The egg splattered because the shell is acting against the cable tie at high G and gave way. The good thing is, at design stage I have considered the possible outcomes and decide to place the egg in a plastic bag for insurance. My insurance paid off! No messy aftermath to clean up!!! The down side, missus will not be pranked until I devise a better contraction to hold the egg.

Oh wait….. I forgot that I don’t have a missus yet.