Table of contents

Thursday 21 August 2014

TheLAMPA – remote controlled, adjustable workbench lamp – part 1


The following post is the first part of a series about my most recent project I’m working on, TheLAMPA. I hope you will like it.

As this is a live project I will be writing new posts along with the progress I make.

I will share my considerations, failures, difficulties, etc. If you have any suggestions, advices (good or bad ) or simply want to help - please leave a comment.  Thank you!

Ok, here we go ☺ 

I have bought a lamp in IKEA recently:  


The lamp is sort of a billiard-lamp shape type. The central part (aluminium H-shaped profile, 80x6x2cm) holds a fluorescent bulb. Then, it has 10cm wide aluminium ‘strap’ running around as a shade.

Ok, it may be quicker to draw it in a MS Paint ☺

This is a top view (the fluorescent tube sits in the middle rectangular part):
 

This is what I would like to do:
  • leave the H-shaped profile untouched and hide there all the electronics, drivers, motors, pulleys, etc.
  • put 16 LED MR16 “bulbs” between the H profile and the shade
  • print mounting brackets for the MR16 sockets and bolt them to the H profile 
  • use only 1 switching-mode power supply, 230V to 12V for the LEDs. For the electronics a simple 5V stabiliser may be enough 
  • use ATmega328P microcontroller to drive the whole thing. The code will be written probably in Arduino IDE as there are plenty of libraries supporting all the hardware I may need for this project.

The program however, will be responsible for:
  • Controlling each LED independently.
    I plan to use PWM (Pulse Width Modulation) – this will allow me to change the brightness of each LED (and of course turn it on and off).
    PWM works in a way that a high frequency square waveform is used (usually between 10kHz and 100kHz) so the eye will not see the flicker. The only variable is the pulse width/duration (how long in a single period the logical ‘1’ is on). If a factor is 50% it means, the HIGH state is for 50% of the time, same as the LOW state (all this happens thousands times a second). If the factor is 100% - it means the LED will be powered constantly. Same with factors like: 10%, 17%, 80%, etc... the LED will be in the ON state just for a proportional time, and then off for the rest. It will be blinking but the eye will not see it - it will be just an average light which will appear dim.
    Seems that TLC5940 is a perfect fit for this purpose. Also, by using different LED types I will get different colour temperatures which could be used for different purposes.
  • Receiving commands from a TV remote controller.
    A popular IR sensor TSOP31238 and a piece of code to understand what the remote controller is saying. Then just implementing actions based on commands received. Instead of using bunch of inputs in the microcontroller for a keyboard I will use only one – to read the data from the IR sensor. I will need to read all the codes first to know which code is assigned to which button. And then I can use the codes in a program. I’m thinking of using Volume Up/Down buttons to change the brightness and the Channel Up/Down buttons to change the height. Also, I’m thinking about making it more advanced, for example pressing a TXT button followed by “90” will make the light 90% or another button followed by “30” will lift the lamp by 30cm. POWER could turn the lamp off and pull it to the highest, park position. And so on, and so on
  • Controlling 2 motors to lift/lower the lamp.
    This will be a bit challenging as I would need to rethink few cases. At the minute I’m thinking about using 2 servos – these are incredibly strong (they have built-in gears already) and very small. The issue is that they only have 270 degrees freedom. I need to take the servo apart and remove the lock. Then it will rotate freely 360 degrees. But... the other issue is that it will not hold the position. A small servo can be turned by hand so the gravity may/will pull the lamp down once the power is disconnected :/  The solution may be to use a worm gear. The construction allows only one direction of driving it – the small, “threaded” gear turns the large one but not the other way around – this is exactly what I need. I’m going to print a cylinder with grooves to allow the lifting string to wind nicely (and not on top of each other, tangling) but this introduces another issue I need to solve: let’s say I want to have a working distance of 1m and the cylinder has 1cm in diameter (remember, we are working in a tight space within the lamp). It means that circumference will be just over 3cm (2*PI*r) so I would need 32 turns to get it done. If I’m going to lie the string every 1mm it will give me a barrel of 35mm in length... not good...
    OR... I could print a big, narrow gear with a string-thick groove in the middle – then the string will be rolled on top of the previous layer. This will eliminate the previous issue but will cause inconsistent lifting speed (as the diameter will change with every layer) and it will be a bit harder for the motor as well (higher = more string = greater diameter = more string to be pulled during one revolution). But if the worm gear will be used – this should not be a problem at all. In this case I may need a faster motor than a servo as one rotation of the worm gear will rotate the big one just by 1 tooth. I will need to test if first as it may be just right ☺  Also, I don’t want to wait 10 minutes for the lamp to arrive where I need it.
  • Reading data from acceleration sensor to make sure the lamp is level (it will be impossible to make identical movement with 2 separate motors). I would like to read the slope degree during lifting/lowering and if the lamp is off more than... 5 degrees? then I will stop/slow down one of the motors and speed up the other one to make the lamp level again. I have two candidates of accelerometers. Basically the same price but one is digital, the other on is analogue. In this project I don’t need super high precision or fast data rate.
    In digital accelerometer I would need to write a protocol to communicate with it, play with configuration registers, read a full set of data, understand it, and then extract only the part I need…
    The analogue one is much easier to implement as it returns a voltage depending on a position of the accelerometer. It returns 3 separate voltages (for X-Y-Z axis) but I’m interested only in one axis so I can use just one pin of the microcontroller to feed it to the built in Analogue-Digital Converter. The choice is: the analogue one, MMA7361.
    The datasheet says 1.65V is zero-g for an axis, so it is „level”. The program needs to consider if the voltage is lower, it need to lift one end, if higher – the other one, until the voltage gets back to 1.65V (with some hysteresis of course).
  • Showing current status on a display.
    A 7 segment, 4 digit display should be enough for the use. By pressing a button it may show the status, height, brightness, selected LED, etc. For example, pressing a MUTE button may show „LED” string, then pressing 5, may show „LED5” - changing settings for 5th LED. Changing height will show the distance, etc.
    I’m also thinking about using a standard, 2x16 LCD screen but from a distance of 1-2m (when the lamp is under a ceiling) it may be hard to read. I could use a library with custom characters, to write big characters using both lines of the LCD but then, I would get the same 3-4 characters display with much worse clarity and viewing angles than the bright and sharp LED display.
  • Recognising lamp’s position/height - another „problematic” point.
    • To measure the position of the lamp I could use ultrasonic distance sensor or an infrared one. If I mounted it on the lamp, pointed upwards I would know how far the ceiling is. But the problem is... dust. After a period of time I will be getting wrong measurements. I could mount it under the ceiling but this will introduce another set of visible wires going to the main board inside the lamp
    • The other option is to use a set of infrared emitter-receiver line and mount it somewhere beside the cylinder with the wire reel. The beam should be broken only when the reel is full/empty (meaning 2 sets of transmitters per motor). The downside of the solution is that this will be very hard to calibrate, align, get repetitive results.
    • 3rd option – multiturn potentiometer. I would need to pick the correct one – depends how many turns the motor/barrel will do for the full range of movement. Let’s say it is 80 revolutions – I could use 100-turn potentiometer. This will give me a safe margin for use the pot without breaking it, giving 80% of its range. Good enough for this project. ATmega328P microcontroller has a 10 bit ADC, it can recognise 1024 levels. In this case it will be „only” 800 positions (if I use a full range of the potentiometer) which gives me resolution of 1.25mm (for the distance of 1m). This is just to know the position of the lamp. The accelerometer will be used to make the lamp level. Also, it will be possible to know where the lamp is after booting up by simply reading the value of the potentiometer.
  • Saving/recalling ‘favourite’ height/brightness.
    The microcontroller has 1kB of EEPROM, so it can store 1024 8-bit values. It will not be erased when the power is off. To store 1 favourite height position and brightness I will need: 1 memory cell to store the height (0-100% or 0-100cm, both figures fit in 8-bit datatype), and then brightness: the PWM can be driven using 8-bit variable, it has 256 levels – same story, just 1 byte per value. Even having 16 LEDs + height position I will need only 17 cells of memory per one favourite setting - it means I could store 1024/17 = 60 settings. I will probably stick to 10 only (easily accessible using buttons 0-9 on a remote controller + a dedicated button to store or recall the settings). 


I have decided to go with LEDs as they use much less power and are more efficient comparing to halogen bulbs – I don’t want to have a 300W heater just beside my head. Also, they are not getting that hot so the printed plastic holders will not melt and also, I will not get my forehead skin peeled off when I touch the bulb accidentally ☺ (for high density boards I may need a lot of light so the lamp will be hanging very low).

I’m hoping to write the next part soon, once I get my head around the above and prepare some materials.


If you like my project and/or you would like to support it, please use the Donate button ☺ 


Follow me on Twitter, Google+, Thingiverse, YouTube or by email to receive the latest updates.




Friday 15 August 2014

Driving across Ireland (2014)

Today I would like to share with you some videos I have recorded while driving across Ireland.

1. Healy Pass, Co. Kerry
2. Healy Pass, Co. Kerry
3. Conor Pass, Co. Kerry
4. Whitewall, Co. Tipperary

All videos have been recorded in 1920x1080, 60fps using a GoPro Hero3 camera mounted on a roof. I recommend watching in full screen, 1080p mode.






Follow me on Twitter, Google+, Thingiverse, YouTube or by email to receive the latest updates.
If you like my blog - please donate :)  This will help me making new stuff. THANK YOU!


Filament cleaner for Velleman K8200 3D printer



People on different forums reported problems with clogged nozzle. One of the reasons may be a dust, powder or some other contamination on the filament.

I have thought, it would be nice to have a little cleaner before the extruder…
I designed it in the way that it can be easily mounted on the frame using one of my clips (FULL or FLAT) and 2 pins.








It can be moved left or right along the frame or rotated to put it in optimal position for the filament to go through.

I cut a small piece of a kitchen sponge – it does the job.
The only thing worth of considerations is that the material used to clean the filament is soft when it is dry as it needs to hold the filament tight – some of the sponges are rock hard when dry (will not surround the filament snugly enough) and get softer only when wet.
 







To download the files - visit my profile on Thingiverse (http://www.thingiverse.com/ljwinkler/designs) or use direct links below:
-        sponge holder (http://www.thingiverse.com/download:722623)
-        full frame clip (http://www.thingiverse.com/download:409393)
-        flat frame clip (http://www.thingiverse.com/download:416539)
-        pin (http://www.thingiverse.com/download:409394)


Follow me on Twitter, Google+, Thingiverse, YouTube or by email to receive the latest updates.

If you like my blog - please use the donate button :)  This will help me making new stuff. THANK YOU!

Wednesday 14 May 2014

3D printed picture frame hook with level adjustment

I bought a picture frame in IKEA but they have attached 2 flimsy, thin metal hooks but I wanted to hang it on just one.
The background is held by 4 metal 'hinges' - exactly in the central point in all 4 sides so I couldn't mount just one hook :/

My design takes care of it.
It also has teeth allowing adjusting the frame's level. 







To download the files - visit my profile on Thingiverse (http://www.thingiverse.com/ljwinkler/designs) or use direct link below:


 

Follow me on Twitter, Google+, Thingiverse, YouTube or by email to receive the latest updates.


If you like my blog - please donate :)

Tuesday 25 March 2014

Zeroplus LAP-C Logic Analyser Logic Cube Windows 8/8.1/10 driver

If you are struggling with the LAP-C logic analyser driver under Windows 8, 8.1 or 10 - you found a right place to be :)

I haven't used it in past few months so I was very surprised when Windows said that is not happy with the driver (after upgrading to 8.1). After spending number of hours finding a solution I came up with this:

1. Download http://www.zeroplus.com.tw/software_download/lac_s31200_all(win8).zip (this is their official file however, I couldn't find it in any place on the zeroplus website)
2. Extract the zip file.
3. Navigate to the "Driver Setup" folder and extract the "Data1.cab" file (or double click on it to see its contents).
4. Copy the following files to: "C:\Program Files (x86)\PC-Based Instrument\ZEROPLUS\DRIVER\"
 - Bulkusb.inf8 and rename it as bulkusb.inf
 - Bulkusb.sys7 and rename it as bulkusb.sys
 - Bulkusb64.cat3 and rename it as bulkusb64.cat
5. Go to the Device Manager, right click on the LAP-C Analyser device, select "Update Driver Software".
6. Click on "Browse my computer for driver software" and select the folder from point 4 above.
7. Enjoy! :)


Hope it helps!  Thanks for big thumbs up!


Thursday 13 February 2014

LED ring light for Velleman K8200 3D printer



This time I would like to present you how I have added a light around the extruder.
Instead of re-inventing the wheel I just bought a simple tent light in Argos (LINK).


It contains 2 rings with white 5mm LEDs and it is battery powered. It takes 3x AA batteries so the maximum voltage is about 4.5V – close enough to onboard 5V. I’m going to drive it using PWM so I’m not worried about exceeding the limits (I’m sure there is a voltage margin in the product design so it will not catch the flames if 4.51V is provided :) 

I’ve created a circular holder for the rings:




To mount the PCB rings – I simply marked all the holes in the PCBs with a tip of soldering iron (mmmmm, that sweet smell of melted PLA :)) and then used some small screws lying around to hold the 2 rings in place.



Then was a time to make some brackets to hold the lights next to the extruder:







To mount it to the Z carriage arm I used clips from my previous design: 
http://ljwinkler.blogspot.com/2014/01/frame-clip-and-locking-pin-for-velleman.html





For the PWM driver I used Atmega328P microcontroller with an Arduino bootloader. It is a bit overkill using a microcontroller for such a simple purpose but it leaves me an open window for future modifications and it was also very quick to set up from parts I had. The other big advantage of this solution comes when a small tweaks are required – it just means changing the source code and re-uploading it back to the microcontroller.
I used one of the analogue inputs (A0 - pin 23) to read value of the potentiometer and one of the PWM outputs (D10 - pin 16) to drive a transistor that controls the LEDs. Atmega328P has a 10 bit A/D converter, therefore it can read 1024 positions of the potentiometer (0-1023). However, the PWM output is only 8-bit (0-255). I have modified the range to be 3-255 – so turning the potentiometer to its edge will turn off the lights completely. I have also added averaging of last 10 readings to prevent flickering.
A 4-pin header (Reset, RxD, TxD, GND) was added for programming purposes.
As a power supply I used the main controller board, pins marked as +5V and GND from the header J1 located in the corner of the controller board.

Here is a quick schematic:

 

List of components used:
  • 1x ATmega328P with Arduino bootloader
  • 1x BUF644 NPN transistor
  • 1x 16MHz crystal
  • 2x 22p ceramic capacitor
  • 1x 10k resistor
  • 1x 100R resistor
  • 1x 10k potentiometer


I have soldered it on a single layer protoboard:


Then I have designed a base for the PCB.
I have created small support elements keeping the board raised 5 mm and holding it in place by two M3 screws in the corners. The whole unit is mounted on the main controller board mount (described here: http://ljwinkler.blogspot.ie/2014/01/controller-board-mount-for-velleman.html)




Afterwards I have created a holder for the potentiometer. I have redesigned one of my clips - this time I used the flat one as there are wires running underneath.




And here is the source code:


// Arduino program for PWM LED lighting
// Copyright 2014 - LJ Winkler (lwinkler247@gmail.com)
//
//-------------------------------------------------------------------------//
// Permission is hereby granted, free of charge, to any person             //
// obtaining a copy of this software and associated documentation files    //
// (the "Software"), to deal in the Software without restriction,          //
// including without limitation the rights to use, copy, modify, merge,    //
// publish, distribute, sublicense, and/or sell copies of the Software,    //
// and to permit persons to whom the Software is furnished to do so,       //
// subject to the following conditions:                                    //
//                                                                         //
// The above copyright notice and this permission notice shall be          //
// included in all copies or substantial portions of the Software.         //
//                                                                         //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,         //
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF      //
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  //
// IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDERS BE LIABLE FOR ANY     //
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,    //
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE       //
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                  //
//-------------------------------------------------------------------------//

/*
 * pin A0 - PWM pot input
 * pin 10 - PWM output
 */

const int numReadings = 10;
const int potINpin = A0;
const int pwmOUTpin = 10;
int potValue = 0;
int pwmValue = 0;
int readings[numReadings];
int index = 0;
int total = 0;
int average = 0;

void setup() {
  pinMode(pwmOUTpin, OUTPUT);
  pinMode(potINpin, INPUT);
  for (int thisReading = 0; thisReading < numReadings; thisReading++){
    readings[thisReading] = 0;
  }   
}

void loop() {
  total = total - readings[index];        
  readings[index] = analogRead(potINpin);
  total = total + readings[index];      
  index = index + 1;                   
  if (index >= numReadings){
    index = 0;                          
  }
  average = total / numReadings;        
  pwmValue = map(average, 0, 1023, 255, 0); 
  if(pwmValue<3){
    pwmValue=0;
  }
  analogWrite(pwmOUTpin, pwmValue);
  delay(1);
}




To download the files - visit my profile on Thingiverse (http://www.thingiverse.com/ljwinkler/designs) or use direct links below:



Follow me on Twitter, Google+, Thingiverse, YouTube or by email to receive the latest updates.

If you like my blog - please use the donate button :)  This will help me making new stuff. THANK YOU!