Saturday, February 6, 2010

Wind of change

This blog has moved to a new home: http://redlogicgames.wordpress.com/blog/

Acest blog s-a mutat la o noua adresa: http://redlogicgames.wordpress.com/blog/

Ce blog a été déplacé à l'adresse : http://redlogicgames.wordpress.com/blog/

Pentru cei 5 din lume care poate urmaresc acest blog: Danke!

Sunday, January 31, 2010

Time to get serious once more...

It has been a long time since I wrote some serious s*** on this blog, mainly due to the lack of time caused by a Master's degree and the job I have in Strasbourg.

The embedded systems love I nurtured since the start of this blog is still with me, although now I have a more realistic vision of its real potential in a real life situation, my life to be more exact. Even though it is a very interesting domain, the fact that I don't have millions of euros to invest in new ideas, renders my impact in this domain to be limited to this blog, and the wacky contraptions that can be made using a PIC micro and some elbow grease. That is it! There is the option of working for a company that has the power to change something, but those are rare and far between, plus the feeling of accomplishment is truly not the same.

Next I thought that the next best thing is to work on devices that are already designed, and just try to take advantage of their hardware and public. Of course Iphone comes to mind, but it is not the only player in the market anymore, since Android, Symbian opened their SDK's to developers.

Unfortunately for the Iphone the ship has sailed a long time ago, meaning that there are already 140000 applications in the AppStore and counting. Next is the Android Market has around 60000 apps, but the trick with this is that for a developer to actually make some money he needs a bank account in a handful of European countries. Bummer! Apple just announced the iPad, which out of the box is just an oversized Ipod Touch, not bad to start with, but useless without real applications to take advantage of the untapped use case scenarios it presents.

For me, this year is all about web programming. and the subject of the next few posts will be Google's GWT and a project called VisualLinks. It is a school project I have to do with a few of my colleagues, in order to receive some credits.

I provided a link to the Google Projects page here

Tuesday, October 20, 2009

Colmar my love

Postez de la servici!!

Acest servici imi mananca ficatii, in principal pentru ca s-a mutat locatia unde o sa invat cu spor Javascript. Ma aflu in pitorescul oras Colmar, aflat la 70 km de Strasbourg. Daca as fi turist as iubi orasul asta, cu cartierul Mica Venetie si casele de lemn aflate la tot pasul, dar nu sunt turist, sunt ucenic la o sucursala mica, cautatoare de suspans si trairi intense. Ma scol la 6:30, iau tramvaiul, apoi trenul si timp de juma de ora ascult muzica (asta cand imi aduc aminte sa imi iau Ipodul cu mine). Intr-un final ajung si ma pun pe invatat. Seara plec acasa iar cu trenul, iar cu tramvaiul...

Proiectul pe care lucrez este in colaborare cu Alcatel, noi trebuie sa construim interfata cu utilizatorul pentru 2 tipuri de telefoane de birou Bussiness Class ale lui Alcatel, utilizand controale Dojo si niste widgeturi facute de echipa pana acum. Nu am mai vazut amestecul asta de tehnologii in viata mea, este o adevarata aventura sa urmaresti procesul de apelare si afisare a unui widget pe ecran. It's murder I tell you!

Sper sa nu mai par asa inmarmurit in fata ecranului prea multa vreme si sa accept ca nu am ce face si ca trebuie sa invat cat mai bine tehnologiile astea, mai ales ca mai am un coleg cu mine care este coleg si de master. E mai simplu el asa, dar azi imi raspunse la cateva intrebari destul de avansate, si e doar de o luna aici, deci asta inseamna ca se poate si mai bine!!!!

Abia astept weekendul!

Tuesday, October 13, 2009

Punct si de la Capat

Bun. E timpul sa intorc o foaie din viata mea. S-au schimbat multe in ultima vreme, nici nu stiu de unde sa incep.

M-am casatorit, sunt fericit, am terminat facultatea, acum sunt la master in Strasbourg, lucrez pe programare web, dintre toate domeniile din lume, s-a gasit loc pentru mine numai pe programare web. Ma doare, dar nu am incotro. Mie dor sa imi ard degetele cu pistolul de lipit, sau sa programez un PIC.

Poate cand ma voi intoarce in tara, pana atunci trebuie sa invat niste tehnologii foarte bizare si inutile luate individual. Asta e parerea mea despre toata latura asta a programarii. Sunt 1001 tehnologii si limbaje care luate individual nu reusesc sa rezolve scopul proiectului, trebuie combinate cu altele ca sa se ajunga la un rezultat acceptabil. Aici in Franta se pune enorm de mult accent pe programarea WEB, WEB 2.0. Aproape toate conferintele, forumurile de studenti, sau ce e si mai grav, aproape toate firmele de programare din zona recruteaza personal special pentru programare web, aplicatii intranet si extranet, ERP.

Mai este Alcatel de exemplu care mai face un tip de embedded, dar este o firma atat de exclusivista, incat e foarte greu de ajuns in randul lor. Mai raman firmele care doresc "maimute" cu 10 degete daca este posibil, si firmele care fac bani din satisfacerea cerintelor firmelor mai mari. La asta din urma am ajuns eu, Actimage Consulting se numeste are traditie de 20 de ani, si a avut destula incredere in franceza mea minimala incat sa ma ia ca apprenti(ucenic). Sper sa incep lucrul peste o saptamana. Don't ask!!!! Stiu... sunt aici de o luna si abia peste o saptamana incep lucrul. Nu stiu cum avanseaza francezii astia, dar sunt mai lenesi ca noi!

Cat despre tehnologia embedded, nu ma dau batut, dar pentru o vreme trebuie sa ma conformez imprejurarilor. Intre timp mi-a venit alta idee, plimbandu-ma pe strada, am observat ca in urechile a 7 din 10 tineri sau bussiness-man stau casti de Ipod Touch sau Iphone. Pana la urma tot "embeddded applications" se numesc aplicatiile capabile sa ruleze pe IphoneOS. Ipod Touch am deja, imi mai trebuie un Mac. Eh aici e problema, costa cat un rinichi pe piata neagra.

Era sa uit, degeaba dau o caruta de bani pe hardware, imi mai trebuie o idee! Ceva care nu s-a mai facut, ceva tot pe interfatarea intre user si internet.

Am asistat recent la un forum al dezvoltatorilor, unde la un Keynote pe la mijlocul zilei, Pannel-ul format din 5 oameni de afaceri, ziaristi, profesori a fost intrebat cati din ei au un Iphone. In secunda urmatoare sincronizati perfect si-au scos toti Iphone-urile. Daaamn! Urmatoarea intrebare fireasca a fost daca considera Iphone-ul viitorul web-ului? Majoritatea din ei au raspuns mai pe langa subiect, dat fiind faptul ca si intebare era gresit formulata. Pana la un ziarist, care a corectat intrebarea si a spus clar ca Iphone-ul este doar o fereastra catre internet, si ca nu are cum sa intruchipeze viitorul internetului, poate doar sa prevesteasca implicarea din ce in ce mai mare a internetului in viata noastra.

Si da! imi e dor de tara, de parinti, de mancare, de mici, mamaliga, si gratarele improvizate te miri unde. Sper sa gasesc tara intr-o stare economica mai buna cand ma voi intoarce.

Wednesday, June 17, 2009

From this day on I am an Engineer

Today was the day I showed my Project in front of a board of professors from my faculty. Everything went as planned, no problems, my Artificial Horizon managed to keep the board interested.

That concludes 5 years of Faculty. Not very much to say, just that I have some new ideas I want to put into practice.

Until next time, Happy Holiday!

Sunday, May 3, 2009

Finally a concrete result.

I finished the hands-on part of my licence Project, I will let the video speak for itself:



Because of the problems I had with the PC/104 System, I had to construct my own Data Acquisition board. It reads the 3 voltages for the 3 corresponding axis and adjusts the Horizontal Sphere on screen through a serial link with the computer. All is well when it ends well!

Sunday, April 26, 2009

One step forward, two steps back

As it turns out, the Directx Application i made is too powerful for the embedded computer at my Faculty (PC/104 system). It turns out that the module containing the microprocessor has an integrated video card with no true 3D capabilities. I am confused, because the Spec Sheets tell otherwise and I quote:

Display:
Chipset: VIA VT8606 Twister chip with Integrated S3 Savage4 2D/3D/Video Accelerator
Memory Size: 8/16/32 MB frame buffer using system memory
One thing is for sure, the DirectX function CreateDevice fails when trying to create a Direct3D device, it only works with an emulated device only suitable for small tests. It doesn't even work in software mode.

Tomorrow I will talk to my attending teacher to try to find a solution.

Monday, April 20, 2009

DirectX Front-End finished

Today I finished the DirectX front end of my project. To be honest I should have thought of this in the first place.

First of all I can now display and simulate a real sphere with the artificial horizon on it, and I can rotate it pretty easily with rotation matrices from DirectX. Let me show you a picture and then comment on it:


Here you see a background PNG image file with transparency in the middle circle. Behind it is a sphere with a texture of an horizon wrapped around it.

Now, in DirectX or any other Graphics Engine API, the transformation of objects in a scene is done using Transformation matrices, for example: Translation, Scalling or Rotation. The last one is the one we are interested in, and since we normaly can move in 3-Dimensions, then it is normal that we have 3 kinds of Rotation Matrices, one for each axis. To combine the effect of any transformation matrices you just have to multiply them in the order you want them to take affect.

Therefore it is now standard arithmetics to convert the reading from the Accelerometer (3 Voltages for 3 axis of movement) to 3 Rotation Matrices which multiplyed give the relative position of the accelerometer board.

I now must add a CALIBRATE button to the scene, to remember the normal horizontal position, and implement an .ini file system for the hardware configuration. Wish me luck!

Monday, April 13, 2009

Agony and pain

During these last few days I began to write the computer frontend of my Artificial Horizon application, using MFC. It has proven to be the worst decision I made since the beginning of this project. I am using Visual Studio 2008 and MFC 8.0 and I thought that Microsoft had improved the stability of MFC applications, but I was wrong. It is incredibly buggy, and the IDE seems to work against the programmer. Every time I added a header file, I had to restart Visual Studio to update IntelliSense, if I deleted a simple editbox from the Resource View I had to manually delete all the references that were automatically added at creation and so on.

The PictureBox control of MFC only allows to display BITMAPS, and I need to be able to display PNG image files with transparency. After an extensive search on the net I learned that I could use CImage, which is an ATL template. It is capable of displaying PNG files in an MFC dialog. I easily wrote a test program, it worked fine at first glance, but after closer inspection I saw that the transparency did not extend to the picture beneath the first PNG, but only to the background color of the CImage control. Another dead end!!

Then I wrote a simple program in a Windows Forms project, which is normal Visual C++ combined with .NET. I managed to get the desired result from the use of it's PictureBox control, but the drivers for the PC/104 platform generate 240 errors at compile time...

I closed the programming session, before I exploded... After cooling of I found a possible solution, and that is to use DirectX.

I will make another post when I have some progress with DirectX.

Wednesday, March 25, 2009

Artificial Horizon Progress 1

Today was a crucial day for this project because I tested the accelerometer breakout-board at work with an oscilloscope to view the actual variations in voltage associated with the movement of the board.

Just a few days ago I finished the assembly of the board. I planned to use 4 springs attached at one end to the 4 corners of the PCB and at another end to a solid back piece, so as to move the board and then release it, to come back to its original position. This didn't work unfortunately, looks like I need some serious springs, and the trouble of finding them is just not worth it.

Let me show you a couple of photos of the finished board:

In this last photo you can see the connector with 8 pins and 6 cables and a 3 pin connector for the power supply (don't worry, only two pins are actually used)



I stole a 3.3 V voltage from the second pin from the left and placed it on the last pin which is the SLEEP pin, and as you guessed it is activated in 0, so I need to set it to 1 so I can get a reading out of the X, Y and Z pins.

I have left 2 pins unconnected, because I want to leave the accelerometer in its default range of 800mV/g and a maximum of ±1.5 G detected on any axis. Thanks to the reading I got today from the oscilloscope, this range of detection is perfect for my application.

I must admit that this type of sensor is truly amazing, at a level state, the X and Y axis are at mid-supply (i.e 1.6V) meaning no G is detected, while Z axis signals it is sensing 1G (i.e. 2.4V). If I turn the sensor up-right, the Y arrow on the PCB points down so the Y pin is at 2.4V, meaning 1G, which is correct, because it is sensing the natural attraction force of the earth. Now if I turn it up side down, the Y pin is at 0.6V meaning -1G(the arrow for the Y axis is pointing away from the earth)

Feeling pretty happy right now... I leave you with my messy desk:

Saturday, March 14, 2009

Shopping again

I went shopping for parts that help me mount and interface my PCB accelerometer to the PC/104 system from my Faculty.

So I bought :
  • 2 9x15 cm perforated test boards
  • 1 NSL 8 pin connector
  • 4 springs hacked from 4 identical pens
Here are some pictures:



The design will become apparent later on, as It is hard to describe it in words.

I must mention that I have not tested the accelerometer yet, I will do that as soon as I solder the parts enumerated above.

Thursday, March 5, 2009

First success and another challenge

I managed to finish the Etch a Sketch project. It has been a good learning trip for me, and I can not wait to start another project.

Today was a good day to pay tribute to international mail service, because I received an important package. My license project implies the use of an accelerometer, and after long searches on the Internet, I ordered the part from Sure Electronics, a company based in China. Well it came and can't wait to start fiddling with it.

Here is a picture of it:It's called 3-Axis low-g Accelerometer MMA7260 prototype PCB, and it measures the G forces on all 3 axis of orientation, it has analog outputs so I must use an ADC to convert the output voltages to useful digital data.

I will make another post to show you how I will mount this PCB onto a bigger control surface.

Monday, February 16, 2009

At last some news

It has been a while since my last post, mainly because I have been very busy with school and stuff, but know I finished most of my school duties and I can now focus on my personal projects.

Needless to say, I had a lot of time to think about new projects, and some of them seem interesting, but first things first, I have to finish what I have started a few months ago and that is my Etch a Sketch embedded clone.

Las time I wrote in this blog, the hardware part was finished, all that was left was the software, both the embedded software and the computer software. Let me specify that I have worked on this project in my spare time(very limited indeed) and some things have changed, my previous post has now become veryyy obsolete, and as a lesson learned, I will reframe myself from posting code until it is working 100%.

The main changes are as follows:
  • OpenGL was not needed for this project
  • I used Visual C# to write the computer frontend
  • The embedded software now waits for a request for data from the computer, acquires the data from the 2 potentiometers, and sends it back to the computer software, this repeats several times a second
I have learned some important lessons in hardware design like how to arrange wires as to not interfere with each other. This is important because the approach I used in my last software design was to send data through the wire only when the data read was different that the last reading. In theory this sounded perfect, the simulator worked perfect, but as I was told again and again, a simulator never replaces the real thing. In real world operation the data read was very gettered, and oscillated between several very close values, and ended up that the hardware was sending data very often, the exact thing I was trying to avoid.

I will begin work again to finish this project and to move on to another. In order to consider this project finished, I have to implement an error detection system on the computer side to ensure that the data read from the hardware is formated correctly. At the moment the software sometimes goes nuts and displays strange lines as a result of bad input.

Saturday, November 1, 2008

Embedded C Code

PLEASE READ THE POST ABOVE
-----------------------------------------------------------------------------------------
Below I have posted the content of the Embedded C PIC program (CC5X compiler) that drives the software inside the microcontroller. It basically sends the readings from the 2 potentiometers at the very beginning, and then stop transmitting, until it notices a change in any value. If that happens it modifies the high order byte of the conversion in order to notify the computer as to which potentiometer has changed its value.


#pragma chip PIC16F870

#include

#pragma origin 4

bit channel_is_0; //global variable to flag that first A/D channel is selected
unsigned char old_low0; //last converted low byte of channel 0
unsigned char old_high0; //last converted high byte of channel 1
unsigned char old_low1; //last converted low byte of channel 0
unsigned char old_high1; //last converted high byte of channel 1

interrupt isr(void)
{
int_save_registers
if (ADIF == 1) //if we have an interrupt from ADC conversion
{
// if channel 0 conversion and low byte value is different than the last, OR
// if channel 1 conversion and low byte value is different than the last
if (((ADRESL != old_low0) && (channel_is_0)) || ((ADRESL != old_low1) && (!channel_is_0)))
{
while (TXIF !=1 );
if (channel_is_0)
ADRESH.7 = 1; //signal the computer that this is the reading for the first channel
TXREG = ADRESH; //send last 2 bits of the conversion

while (TXIF !=1 );
TXREG = ADRESL; //send first 8 bits of the conversion
}
if (channel_is_0)
{
old_high0 = ADRESH;
old_low0 = ADRESL;
}
else
{
old_high1 = ADRESH;
old_low1 = ADRESL;
}

ADIF = 0; //clear the flag
}
if (RCIF == 1) //we have a byte received in the buffer
{
if (RCREG == 255)
ADIE = 1; //enable A/D interrupt
else
ADIE = 0; //disable A/D interrupt
}

int_restore_registers
}


void main(void)
{
//configuration of ADC
ADCON1 = 0b.1000.0100; //RIGHT Justified format, all pins of PORTA are analog inputs)
ADCON0 = 0b.0100.0001; //FOSC/8, channel 0, ADC module is now ON
//next we must enable global interrupt from ADC complete conversion
INTCON.6 = 1;
INTCON.7 = 1;
//clear ADC interrupt flag bit
ADIF = 0;
ADCON0.2 = 0;
RCIE = 1; //enable reception interrupt
//next we must configure the UART Transmit
SPBRG = 25; //this would generate a 9600 baud rate
TXSTA = 0b.0010.1100; //8 bit trabsmission, enable transmit, async mode, high baud rate
RCSTA = 0b.1001.0000; //serial port enable, 8 bit reception, enable reception
while(1)
{
if (ADCON0.2 == 0) //if ADC GO bit is not set
{
if (ADCON0.3 == 1) //if first channel is selected
{
ADCON0.3 = 0; //select the second channel
channel_is_0 = 0;
}
else
{
ADCON0.3 = 1; //else select the first channel to convert
channel_is_0 = 1;
}

ADCON0.2 = 1; //Set ADC GO bit
}
}
}

Wednesday, October 29, 2008

Faculty License project

"Simulation of an Artificial Horizon system necessary for aircraft piloting" This long and pompous title is the name of my License Project. More news to come after I finish my current Etch a Sketch project, all I can say is that it is going to prove quite a challenge...

Saturday, October 25, 2008

Should I give OpenGL a chance?

Because of a school project, I am compelled to learn OpenGL. I think that it could serve my purposes just fine for this particular project, but as I will progress with more daring projects, which I hope will involve quite a bit of physics, OpenGL will not be a viable solution.

As a side note, I have come up with several other fun applications for this gizmo I am building, for example I could control a game of classic PONG.

Final module is in

I've done it! The nasty part of this project is finally over. I mean the hardware part, the part where I have practically no experience. The board was completed Friday night, today I have tested it with my Win32 Library that I have written a while back. I still have to level out some bugs, but in general it works decent.

Here is a look at how it looks like completely assembled:


And now a back-side view:


Next I must eliminate all the bugs, make the embedded PIC C code as efficient as possible, and then start to write the game using Irrlicht of OPENGL(maybe a new post will follow about my change of heart)

Saturday, October 18, 2008

Serial Module

This week I had the task of soldering the Serial Module to my board.
The serial module consists of the following:

  • Max232 IC
  • 3 1uF capacitors
  • Db9 Serial connector
Things did not go smoothly, but in the end I managed to pull it off. Below is a picture of the finished module:

Now, a short description of why I need MAX232 and how it works. This IC (integrated circuit) converts TTL/CMOS voltage levels for 1 and 0 to RS-232 voltage levels. Here is a quick comparison to show you what I mean : "1" in TTL is roughly 5V, and 11V in RS-232, while "0" in TTL is 0V and -11V in RS-232. When I add the fact that my PIC16F870 knows only TTL voltage levels and any computer knows only RS-232 when it comes to simple serial communication, you understand the need for such a IC.

It works by the aid of 3 charge pumps, which in our case are 3 1uF capacitors, one for the internal voltage doubler, one for the voltage inverter and the last is placed in my case, between the +10V pin and the 5V rail of the board. All is made even clearer by the datasheet.

I tested this module by connecting the board to my computer, to COM1, fired up Hyperterminal, and joined pins 11 and 12 of MAX232 IC, essentially making a loop back, the bytes sent from the computer where converted to TTL levels, and then converted back (pins 11 and 12) to Rs232 levels, then sent back to the computer. It worked fine as I could see the characters I inputted in the terminal where bouncing back on the screen. Job done!

I have only the main microcontroller part to solder on and the eureka moment is finally approaching. Happy me!!

Sunday, October 12, 2008

First module

Today I have soldered the first module, the voltage regulator.



You can see the pre-drilled holes where the linear potentiometers will be, and the Db9 connector is only glued, but not soldered. That is because there is no direct way to solder that connector to a perf board, the pins do not match the holes, so I bent an entire row of pins which are not used by our application. Soldering of this piece will proceed shortly.

Saturday, October 11, 2008

A little shopping

Time for a new post. After a long week at work, I finally managed to write to you again. I finished designing the board, and I also found the time to buy all my necessary parts.

Basically, there are 3 separate modules that come together to form a single unit.First you have a Voltage regulator module, that converts 9V of unregulated voltage and delivers 5V of regulated voltage. Since a microcontroller is very sensible about unstable voltages, this module is very important. Here is a list of parts and a picture of it:

  1. 1 Jack
  2. 1 Diode 1N4007
  3. 1 Voltage regulator LM7805
  4. 2 Capacitors (100 uF and 10 uF)
  5. 1 Switch
  6. 1 330 ohm resistor
  7. 1 LED
Next there is the Microcontroller module, which mainly consists of a 28 pin Socket, where we will place the PIC16F870, the timing circuit for the micro, and the 2 Linear potentiometers which will guide the cursor on our computer monitor. Parts needded:

  1. 1 28 pin microcontroller socket
  2. 1 4 Mhz quartz oscillator
  3. 2 15pF capacitors (as stated in the micro datasheet)
  4. 2 10Kohm linear potentiometers

Next we must deal with the serial module, this is type part of the board that ensures the communication with the computer via a serial cable. Parts we need:

  1. 1 DB9 serial connector
  2. 1 MAX232 IC
  3. At least 3 1uF capacitors (to act as charge pumps for the MAX232 IC)
  4. 1 Male to Female serial cable
In addition we must have a perforated board of about 10cm x 10cm, and a bunch of insulated wires, to make the necessary connection on the board.