[Scilab] Plot oscilloscope big csv export

Some days ago I tried to learn more about SPA (Simple Power Analysis attack), I take my Rigol scope and set the Long Memory Mode.

I stored the trace in CSV format on my usb key and searched for a way to print a csv with 1 Mega samples… You can forget about Gnumeric, LibreOffice or Excel, I found some "projects" but really nothing fancy (or even usable). Last option Scilab or Matlab. I tried Scilab some time ago and was a little disappointed (no documentation or resources). But it’s Free !

This time it was a good surprise, the console has the code/path completion and a variables watching window ! To be simple Scilab support CSV import and plotting without too much problems :)

First code (and really bad one, deprecated you can find on some website):

my_data = read_csv(filename);

Why bad one ? Because it will generate you a String Matrix with col_num * samples elements… And the only way to use that stuff later is to do an eval() on each… If you have some hours to lose that’s a good way :D

Second code ( the one I use):

stacksize("max"); //to avoid import problem
values = csvRead('NewFile0.csv', ',', '.', 'double'); //take care to set separator and decimal sign as you need
plot(values);

Full trace view (1M sample/1 channel)
full trace

Zoomed trace view
zommed_trace

Documentation
Deprecated read_csv – Function Help
csvRead – Function Help

[Current Regulator] First PCB and Microscope Lightning

Hello, It has been sometimes I didn’t write anything here. I had plenty of projects and things to do ;) At the beginning of this week I finally receive my seeedstudio (a little advertisement for their great quality services !) and as usual it was perfectly synchronized with something I need !

I receive my Olympus BHM microscope for IC reverse the previous day directly from USA, and need to change the light because of an old 110V only auto-transformer.

Olympus Tokyo 110V auto transformer

Olympus Tokyo 110V auto transformer

LED Mount FrontLED Mount SideMount View
So why not using a LED I just took an aluminium plate and drill holes for mounting in place of the light bulb mount. I put a 1 Watt only LED and it’s bright enough to do Brightfield observations, but not for Darkfield, I have some spare 2W LED, I’ll give it a try because my current regulator can go up to about 1A. For more about Microscope part stay tuned for an other blog post explaining why ;)

The PCB I receive is a 3 channel implementation of the current regulator you can see on previous blog post concerning this topic, I have some minor correction to do on the layout (size of sens resistor and change connectors), I need to implement the two other channel in software and add some protections and more precise regulation algorithm. I think I’ll add some Polyswitch(c) on the board too because short circuit are not handled quickly enough. I didn’t want to add some comparator to shutdown the board but I should have…

By the way the prototype running on my desk lamp is always up since November 2012 so I’m happy with that !
As usual you can access everything on my repository.

Current Regulator Schematic

Back of sashaFront of Sasha

[Current Regulator] Final Prototype and ESR considerations

Introduction

First news the final prototype is working, with all modifications done. 2 days before receiving my Chinese LED the light bulb of my desktop magnifier died in some mysterious ways, simple coincidence or an Enigma of the Mystical… We will never know ;)

By the way my LED current regulator seems to be right in time. I began by removing the light bulb and his mounting, I kept the heat-sink which protect plastic to put the LED on the metal with some thermal paste.

The Problem

The regulator worked nicely but there was too much ripple in the output. The problem was not present in the Spice simulation. In fact, on the first round I didn"t have low-ESR capacitors I just put two E-Cap of 10uF and forget it. It tooks me One week to understand the problem:

High ESR Capacitors

This measure is done with two Chemical Caps 2x 10uF, Yellow line is the output voltage, Blue line is the Voltage accross the sense resistor of 1 ohm, so it’s exactly the current flowing through the load.

As you can see the Ripple is really High, about 350mA. Before testing with ceramic capacitors (in fact I didn’t have them at that moment ;) ) let’s take a look to the LTSpice simulation. Following The Wikipedia ESR article chemical capacitor have an ESR in a range of 0.1 to 3 Ω

Spice Simulation

R2 = 30Ω

C2 = 20uF We will modify the Equ. Series Resistors to validate the ESR idea ;)

When ESR = 0Ω

Ripple current = 4mA

ESR = 1Ω

Ripple Current = 27mA

ESR = 3Ω

Ripple Current = 65mA

Testing

I finally got my ceramic 1210 10uF capacitors time to measure the Ripple and validate Spice simulation ;) The Ripple current is ten times less important with these capacitors.

Next step

Next step will be to correct the kicad schematic to add the Totem-Pole configuration and etch a PCB to see if I can reduce the ripple again with clean soldering.

[Current Regulator] Working "prototype" (en)

I have a working prototype of the current regulator. If you took a look at the previous post, I implemented a totem pole because of some stability problem on the Mosfet switching. It’s always a good idea to drive Power Mosfet with this kind of circuitry if you use an uC. But in that case it was not a Gate capacitance problem. It was a simple problem of decoupling capacitors… I forgot to put some caps on the Vcc rail, on the first switching the current was too high to keep a stable 5V Vcc, you can imagine… Lire la suite

[Current Regulator] Troubleshooting (en) [Updated]

Hello,

Update 2: Even with a Totem-pole there was some problems… After some investigation I was hit by the truth, NEVER FORGET COUPLING CAPACITOR… The first schematics is almost correct, I just need to add some big capa on the VCC, in fact the current on the first switch was too high and put the PSU in protection mode…

Update: It seems, without Totem-pole and the FET gate directly on the PIC pin the system is really unstable, with short-cut on the PWM and other black magic troubles, so even if it works most of the time, I’ll go with a totem-pole design.

I made some tests on this project with a breadboard. When tere is no load on the output the 100kHz PWM works fine, but when I put an heavy load (under about 50ohm) the PWM collapse and the switching becomes really unstable. I didn’t investigate too much but I think I was too optimistic on the Gate driving power of the pic18f and forgot to put a totem-pole like driving circuitry.

On the other hand I tested with an old sample of dscpi30f3010 I have. And it works great, you should not that this DSPic family have specific PWM output for Motor driving with a Sink/Source Current of about 25mA. So I’ll go with it and push the source code when it’ll be ready. I’ll modify the schematic to reflect that and do an other version with a totem pole and a little PIC18F.

Stay tuned ;)