Epic Re:load v2 review

Image

Re:load v2 is an adjustable constant-current load.

A really cool thing is that it is self powered and can go to 3.3v keeping it’s current limiting capabilities. I went for the 0-6 Amp version since the price difference is minuscule and it seemed more useful in the future. According to the documentation it can handle 20 W or more with the larger heat-sink. Who does not like having some extra leeway…

Please see the full review as well as build process in my YouTube video:

Project BAC v.1.1

Image

This post is about a project that took ages to built and I manage to loose in an unfortunate circumstances…

I always wanted to build a clock. And this is what came up…

The Idea

Create a modular clock that has interchangeable displays.

The Execution

Main controller

ImageImage

Image

The main module for the clock is an ATmega328 microcontroller with a DS1307 Real Time Clock. The LCD displays current date and temperature as well as shows the setup menu.

Interaction with the clock is done by one rotary encoder that has a built-in push button. The state diagram for the menu can be found below.

Image

Display Controllers

Image

Time display (described below) is controller by a series of 74HC595 shift registers. Since there is a need for two digits per segment (by segment I mean hours, minutes and seconds) there are 6 of them in total connected in series. To update the time display I have to shift out the current state of the hours, minutes and seconds every second. Since the update rate is relatively slow no stress is applied to the microcontroller and it can do other tasks like displaying temperature readings, etc.

Time display

ImageTime is displayed on a self-built 7 segment displays. There are 3 LED’s for the horizontal axis and 4 for the vertical one. By testing various combinations I found that this setup was the most appealing to my eyes. LED’s in a segment are connected in parallel and routed to the input connector at the bottom of the board (color-coded cable in the photo). The only problem I had with the displays was that they were really bright even on the lowest brightness setting (that can adjusted through the menu). To mitigate this problem I added some plexiglass that I painted white to diffuse the light a bit. Note to myself for the future projects: do not use clear LED’s for such applications…

More photosImage

Image

Image

A short clip showing the testing of the time display

Conclusion

I had a lot of fun working on this project. It was a really nice learning experience and I am planning on rebuilding the project in the future with some improvements.

Audio switcher

I’ve been looking for a while now to find a way to switch between multiple audio sources and output them on my speaker system.

Finally, I decided that the simple way is the best way :), so there’s what I came up with.

This is a 3P4T switch with four 3.5mm stereo female audio jacks acting as input and a 3.5mm stereo female audio jack that outputs the selected channel to the speakers. The knob points to the channel that is selected. Audio sources in this photo is my main PC and a Media laptop used for watching videos. There’s still two unused inputs left for connecting my phone/tablet/etc.

Now some photos from the build process:

I’ve spend approx. 100 DKK (17.5USD) for the parts (box, switch, knob, audio cable) that I did not have in my spare parts bin, but also had lots of fun building it, so, to my mind, it was worth the price.

Setting DNS servers using NETSH

I have just faced an interesting problem at work. When I log onto work’s WiFi network I have to use a DNS server that is assigned by DHCP. After logging in, there is some bug that does not allow me access to company’s web page that is public on the Internet. So I came up with this little trick:

  • Set DNS to be retrieved via DHCP
  • Log into the network
  • Set DNS back to Google ones (8.8.8.8 and 8.8.4.4)

And all of this can easily be done using NETSH command (everything is in a “.bat” file. It requires to be run with administrator priviliges):


ECHO OFF

ECHO Setting DNS to DHCP mode...
netsh interface ip set dns name="WiFi" DHCP
ECHO ...done. Press ENTER to set DNS back to Google's servers

PAUSE

ECHO Setting primary DNS server...
netsh interface i set dns "WiFi" static 8.8.8.8
ECHO ...done. Setting secondary DNS server...
netsh interface ip add dns name="WiFi" addr=8.8.4.4 index=2

ECHO ...done.

PAUSE

NOTE: My wireless connection name is “WiFi”. Adjust it to match yours accordingly.

CMD output

ST7735 1.8″ TFT Dispay: SPI vs General connection

Intro

I got a ST7735 based lcd from ebay and decided to play with it a bit.

Setup

  • Arduino UNO
  • 1.8″ TFT LCD from ebay
  • Some jumper cables

Code

All the guidelines for connecting the LCD to the Arduino can be found here: http://www.ladyada.net/products/18tftbreakout/, but there is one thing to note. In the tutorial there is a pin called “dc” (Data/Command) (thanks to sza2) (I am not sure what that stands for) , but on my LCD it’s named  “RS” (register select). So, to make it work, just ignore the difference in naming.

Display driver library: https://github.com/adafruit/Adafruit-ST7735-Library

And the required graphics library: https://github.com/adafruit/Adafruit-GFX-Library

I am using the demo-sketches from the AdafruitST7735\examples\:

  • graphicstest
  • graphicstest_highspeed

Comparison itself

In the video you can see the communication protocol speed comparison.

Conclusion

SPI is the way to go 🙂

Scams online

Several days ago I received the message below from John Kashani (jkashani1) as a Skype message. It makes quite an interesting read… It’s clearly a scam! Be careful.

[21/06/2012 04:06:22] John Kashani:

Dear Sirtautas,

I have been in search of someone with this last name “Sirtautas”, so when I saw your name I was pushed to contact you and see how best we can assist each other. I am Mr. John Kashani, regional manager in one of the leading bank here in Acrra Ghana. I believe it is the wish of God for me to come across you on search now. I am having an important business discussion I wish to share with you which I believe will interest you because, it is in connection with your last name and you are going to benefit from it.

One Late Mr. George Sirtautas, a citizen of your country had a fixed deposit with my bank in 2004 for 36 calendar months, valued at US$6,000,000.00 (Six Million United State Dollars) the due date for this deposit contract was this 16 of January 2007. Sadly GEORGE was among the death victims in Tuesday, May 02, 2006 fatal accident in the Ashanti Region road, Ghana that killed 14 people. He was on a business trip and that was how he met his end.

My bank management is yet to know about his death, I knew about it because he was my friend and I am his account officer. Mr. GEORGE did not mention any Next of Kin/ Heir when the account was opened, and GEORGE was not married and no children. Last week my Bank Management requested that i should give instructions on what to do about his funds, if to renew the contract.

I know this will happen and that is why I have been looking for a means to handle the situation, because if my Bank Directors happens to know that GEORGE is dead and do not have any Heir, they will take the funds for their personal use, so I don’t want such to happen. That was why when I saw your last name I was happy and I am now seeking your co-operation to present you as Next of Kin/ Heir to the account, since you have the same last name with him and my bank head quarters will release the account to you. There is no risk involved; the transaction will be executed under a legitimate arrangement that will protect you from any breach of law.

It is better that we claim the money, than allowing the Bank Directors to take it, they are rich already. I am not a greedy person, at the conclusion of this business, you will be given 40% of the total amount, 50% will be for me and 10% will be for orphanage homes, my share will assist me to start my own company which has been my dream. Let me know your mind on this and please do treat this information as TOP SECRET.

Please reply as soon as possible to my private email account below so that i will give you full details on how the business will be executed: gjkashani@gmail.com

I look forward to hear from you as soon as possible.

Best Regard,
Mr. John Kashani.

gjkashani@gmail.com

Galaxy Nexus ADB drivers

So, I got this awesome phone (Galaxy Nexus I9250)  some time ago, and I had been fighting with the drivers for ages… Approx an hour ago for some reason ADB on my laptop (Asus N53SN) lost connection to the phone. After reconnecting it Windows (7 Pro, x64) showed that device was not recognized.

After doing some googling I managed to get it working again. Seems that EU version of the phone has no drivers available directly from Samsung’s site :(. While googling I came to this site: http://developer.android.com/sdk/oem-usb.html. Seems that one has to download drivers for US Verizon version of the phone. Link for the main page: http://www.samsung.com/us/support/owners/product/SCH-I515MSAVZW

After downloading the drivers, run the “Verizon_Wireless_I515_Galaxy_Nexus_USB_Driver_v1.4.6.0.exe” and let it install. After drivers have been installed connecting the phone to the computer should result in it <phone> being recognized correctly.

Yay, success. Hopefully this can help somebody that is facing the same problems.

Project LIBMS: Li-Ion Battery Monitoring System

Creative Commons LicenseLIBMS by Vaidas Sirtautas is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
 Permissions beyond the scope of this license may be available
at https://sadiav.wordpress.com

Video

or you can watch in HD on Youtube.

Problem

Let’s start with a problem…

In order to have my phone as well as my BlueTooth audio headset working I had to carry two different chargers to workplace.  Moreover, I needed to find an unused socket to plug them in. And that’s really annoying…

Idea

I could see two possible solutions:

  • Buy a charger that uses batteries and provides 5V to charge my devices
  • Build one of my own

And, of course, I went with choice #2. I had some Lithium Ion batteries lying around. And this was the starting point of LIBMS.

LIBMS

It would be crazy to just power devices through some voltage regulator. LiIon cells do not like to be discharged below 3V and without some additional circuitry it was impossible to check whether they were OK to continue providing power to the devices. (Well, I could carry a multimeter and measure each of them from time to time, but that would be crazy :))

I found some IC’s that are capable of monitoring LiIon batteries, but where’s the fun in that…

I had some Atmega328 chips laying around. They have a 6 channel 10-bit ADC (there is actually only one ADC, but built-in multiplexer expands the inputs to 6). Awesome.

Batteries

I connected 3 of the batteries in series and then that block with another block of three batteries in parallel. V1..V6 show my tap points that are used to measure each cells voltage. E.g.

  • V(G2) = V2 – V1
  • V(G3) = V6 – V(G2)
  • V(G6) = V6 – V(G5)

Batteries are connected this way

Voltage regulators

At the beginning of this project I had some problems with voltage regulation. I powered the microcontroller (uC) directly from the main voltage regulator (LM338), but when a device was connected that requires a lot of current the voltage suddenly dropped and uC restarted. Not good…

I solved this problem by introducing secondary LM7805 voltage regulator that is used to power the uC and LM338 takes care of the USB ports. Using this structure provided me with a cool way for controlling the USB ports from uC.

Browsing through the LM338’s data-sheet I found an example where the regulator can be controller using a TTL signal. Perfect. Even though it does not shut down completely (there is still ~1.25V on the output), it does the job.

Sensing part

Because Atmega328 can measure up to 5V max, I had to scale down the voltages of the cells. To do that I used voltage dividers. There are 5 of them, connected to ports A0..A4. Resistors (with values specified) are R1..R10 in the schematic.

Schematic & PCB layout

*Click on the images for hi-res version.

There is a 10K pull-up resistor (not shown in schematic) connected from BC337 base to Vcc to ensure that Voltage regulator stays off while uC is starting up.

Code

This code was written using Arduino IDE (www.arduino.cc)

int analogValues [5];
int voltages[6];

unsigned char i; // Loop variable
byte LEDs = 0;
byte tempLEDs = 0;
boolean turnOn = true;
boolean updated = false;
boolean firstrun = true;
byte portVal;

byte LEDstates[] = {
0xFF, 0xDF, 0x9F, 0x1F, 0x0F, 0x07, 0x03, 0x01, 0x00};

void setup()
{
// Set Transistor's pin to output
pinMode(8, OUTPUT);
digitalWrite(8, HIGH);

// Set LED pins to outputs
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);

// Set analog inputs
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);

// Disable Pull-up resistors on analog pins
digitalWrite(A0, LOW);
digitalWrite(A1, LOW);
digitalWrite(A2, LOW);
digitalWrite(A3, LOW);
digitalWrite(A4, LOW);

for (i = 0; i < 9; i++)
{
tempLEDs = LEDstates[i];
updateLEDs();
delay(500);
}
delay(1000);
}

void updateLEDs()
{
PORTD = (PORTD & 0x1F) | (tempLEDs & 0xE0);
PORTB = (PORTB & 0xC1) | ((tempLEDs & 0x1F) << 1);
}

// Scale because of voltage divider by 2.624
void loop()
{
if (turnOn && updated)
{
digitalWrite(8, LOW);
updated = false;
}
if (!turnOn && updated)
{
// Serial.println("turn OFF");
digitalWrite(8, HIGH);
updated = false;
}

// Read status of all batteries
for (i = 0; i < 5; i++)
{
analogValues[i] = analogRead(i);
delay(10);
}

voltages[0] = analogValues[4];
voltages[1] = analogValues[3] - voltages[0];
voltages[2] = analogValues[2] - voltages[1] - voltages[0];
voltages[3] = analogValues[1];
voltages[4] = analogValues[0] - voltages[3];
voltages[5] = analogValues[2] - voltages[4] - voltages [3];

// Take care of low voltage per cell situations
//  Minimum threshold for a cell is 3.0V.
// Minimum value is 3/(5/1024) = 614.4
// Scaled because of voltage divider by 2.624,
//   so 3V = 614/2.624 = 234 units
boolean stopLoop = false;
i = 0;
while ( i < 6 && !stopLoop)
{
if (voltages[i] < 234)
{
stopLoop = true;
turnOn = false;
updated = true;
digitalWrite(8, LOW);
// Enter infinite
loop while (1) { };
}
i++;
}
//Serial.println(analogValues[2], DEC);
// Take care of LED's
if (analogValues[2] > 920) // 11.8V
tempLEDs = LEDstates[0];
else
if (analogValues[2] > 889) // 11.4V
tempLEDs = LEDstates[1];
else
if (analogValues[2] > 858) // 11.0V
tempLEDs = LEDstates[2];
else
if (analogValues[2] > 827) // 10.6V
tempLEDs = LEDstates[3];
else
if (analogValues[2] > 796) // 10.2V
tempLEDs = LEDstates[4];
else
if (analogValues[2] > 765) // 9.8V
tempLEDs = LEDstates[5];
else
if (analogValues[2] > 734) // 9.4V
tempLEDs = LEDstates[6];
else
tempLEDs = LEDstates[7];

// Something changed in total battery voltage
if (LEDs != tempLEDs)
{
LEDs = tempLEDs;
updateLEDs();

/* My old idea...

// First three LED's
tempLEDs = tempLEDs >> 5; // Right shift by 5 to get first three bits
tempLEDs = tempLEDs << 5;

portVal = PORTD;
portVal = portVal << 3; // Right shift to get rid of last three bits; portVal = portVal >> 3; // Left shift to restore first 5 bits to their positions
PORTD = portVal | tempLEDs;

// Restore temp value that changed because of all the shifting
tempLEDs = LEDs;

// Last five LED's
portVal = PORTB;
tempLEDs = tempLEDs << 3; // get rid of first three bits tempLEDs = tempLEDs >> 2; // position temp byte correctly

if (turnOn) tempLEDs = tempLEDs | 1;
PORTB = tempLEDs;

// Restore temp value that changed because of all the shifting
tempLEDs = LEDs;
*/

}

if (firstrun)
{
updated = true;
turnOn = true;
firstrun=false;
}

// Delay before next run
delay(1000);
}

 

Eagle files

Will be uploaded later

Nexus One: Gingerbread update

Intro

Gingerbread is finally out for Nexus One… And, of course, I could not wait for OTA update… So, after short discussion with myself decision was made to update manually…

Everything is not as easy as it seems…

Unfortunately everything did not go as smoothly as I expected. First of all, trying to update my Nexus One (stock, unrooted and without unlocked boot-loader) running Android 2.2.1 through recovery mode always gave me that annoying “E:failed to verify whole-file signature” error message. Tried maybe 10 times. After googling a bit I found out that I cannot update directly from 2.2.1 to the latest Gingerbread (2.3.3). Then I tried to update to 2.2.2. The same problem… Verification of the whole-file signature failed again.

More googling 🙂

After reading through a lot of tutorials I came to xda-developers forum. They provided some guidelines, but the tutorial was not complete. Every try resulted in “E:failed to verify whole-file signature“. I did not want to unlock the boot-loader, so the search continued…

On the forum there was a link about how to prepare N1 for Gingerbread. And this was the starting bit that was needed to move the process forward.

NOTE: Going through the following steps will delete all you info from the phone! BACK UP FIRST!

The tutorial

Installation process can be followed on the video here

(watch on Youtube in high-quality)

Step One (from androidcentral forum)

Video part: 00:38-03:04

I had to restore Android 2.2 on the phone before moving to 2.3.3. To do that I:

  • Downloaded Passion-FRG33.zip ROM file from here.
  • Renamed it PASSIMG.zip. (must be exact name!)
  • Placed PASSIMG.zip to the root of my SD card on the phone.
  • Turned off the phone.
  • Then I had to turn on the phone while holding VOLUME DOWN button (hold down the button and press power button)
  • Phone found the PASSIMG.zip file and by Accepting the install (click VOLUME UP) I got it installed

Step Two (from xda-dev forum)

Video part: 03:05-10:21 (for some reason the video starts again after 10:21. Please just ignore it 😉

  • Downloaded the full 2.3.3 ROM from Google. Link here.
  • Deleted the PASSIMG.zip file from the card. (<–IMPORTANT!!)
  • Renamed the “656099b119f8.signed-passion-ota-102588.656099b1.zip” to update.zip (must be exact name!).
  • Copied it to root folder of my SD card. (SD_card/update.zip)
  • Turned off the phone.
  • Turned on the phone while pushing the trackball’s button down.
  • Selected BOOTLOADER-> RECOVERY on the screen with the skating Androids.
  • Phone restarted and when Exclamation symbol appeared I pushed  Power and Volume Up buttons. (At the same time!!! Might take several tries)
  • Screen appeared where I, using trackball, selected “apply sdcard:update.zip

Video

I created a “short” video about this update process. It shows update process in real time, so you’d have a reference point to see how long everything takes.

BTW, I guess I over-edited the video a bit too much… The actual error screen is not shown 😦  Please take a look at this video if interested.

Step ONE: 00:3803:04 (installation more or less in real time)
Step TWO: 03:0510:21 (installation in real time)

The End

Please feel free to comment and ask questions.

Music Box Thingy: a rotary sequencer v1.0

Intro

This post is about a fourth semester project that our group did. The project was featured in Roskilde 2010 Festival. I was responsible for electronics part of the product.

Everything started form an idea…

Decision was made to create something that would make it easier for people to “break the ice”. There were several iterations of the product till Music Box was born. We decided on creating a rotary sequencer. There were two versions that were used for real-world testing.

Implementation… v1.0


First test was done in a club called Culture Box.  This is where the first iteration of the Music Box v1.0 was used. It has a really simple design. Activation of the steps is done by some push-buttons with levers. Levers move and push a button when a can is inserted into a hole.

There are 32 holes in total (four instruments with 8 steps in each). This means that input from 32 buttons had to be gathered. We decided on using multiplexers this way expanding possible input count on Arduino.

There were four of these boards because each has 8 inputs that are sent through 1 channel (in normal words it is 8:1 mux).

For indicating which step the sequencer was on we used LED’s that went from the inside of the circle to the outer most hole.

LED’s are controlled by Arduino via serial-in-parallel-out shift register.

Testing

Now some photos from the Culture Box…

And this is me deeply thinking about how well it works 🙂

Videos

Do not forget to watch in High Quality...

Exam presentation video

Stress testing Music Box

Inserting LED’s

Pitch for RedBull

More photos can be found on my facebook page: https://www.facebook.com/album.php?aid=2046676&id=1025350161&l=3af7249acd

To be continued…

This is first part of the Music Box description. Second part (Roskilde Version) is coming soon.