Archive for September 2010

Now the Schematics and the Eagle Files have been updated into Source Forge. A single non-Isolated 5V CAN Transceiver is used SN65HVD251 with a resistive Level conversion for the 3.3V circuit. Also included is a button for Reset and a dedicated button for the VSCP Init function.
Here is a picture of the current schematics:

Possibly the SD card connector that I use needs to be pictured.
As we can see from the picture only 7 pins are used. The Kosh module also gives provision for this connector only(8th pin in NC). Possibly in the future we can look for a real SD card connector on board. But this trick was real neat so I am following it.
The technique used here is taken from dharmanitech.com's SD card Article.

Let me know your suggestion to make this project Better.
Battery has become the key source of energy in the Emerging Low Power Devices. It's important to note that the capacity is a limitation for batteries, so they need to be used wisely.
To help in this regard we would like to share our Battery Life Calculation Technique that we have used successfully in many of our projects.

# First of all let's start with the basics of identifying some of the key characteristics of any system that is battery driven:

- Cycle Time: t(p)
This is a unit time between any two subsequent wake-up(or Active Mode) or sleep(or Low Power Mode) timings of any battery driven device. This is also known as Operation Cycle.

- Sleep Time: t(sleep)
This is the total time within one operation cycle time of a battery powered device, where it consumes the least amount of energy( in terms of electric current ).

- Active Time: t(act)
This is the total amount of time within one operation cycle time of the battery device where it consume energy
more than it does in Sleep Time t(sleep)

Hence, t(p) = t(act) + t(sleep)

# Next, would be to determine the Operation Cycle:
We know that for every specific operation the device performs some tasks and then go back to Low Power mode. The rate at which this switching is performed determines the battery life and is also required to determine the Cycle Time t(p).

E.g.1
Let's take an example of a thermometer that needs to perform temperature measurement every hour in a Day
and for rest of the time it remains in low power mode.

So, Rate of Therm. Operation (in days) = 1/24 day

Since, there are 24 hours in a day and it needs to perform the measurements on an hourly basis.
Also expressing of the rate can't be directly in days , as it makes things difficult for embedded guys who deals
with Milli-seconds. Let us now convert the above mentioned rate in terms of milliseconds.

Rate of Therm. Operation (in mS) = (1/24)*24*60*60*1000 mS = 3600000 mS

Now, if you closely observe this rate is nothing but the Operation Cycle since it's exactly the distance between the two subsequent Measurements.

Thus, have been able to find our first parameter Cycle Time t(p) = 3600000 mS

# Next job is to find the Active Time t(act):
This is the time taken by the battery device to do it's intended function. It is important to note that this
time can be subdivided into multiple tasks on the basis of device current consumption.
Shown below is the current verses time graph for a typical battery powered device.


The time and current values of all these tasks are used to find the Energy Time Product(express in mAmS ) which can then be multiplied to voltage to obtain Energy Capacity(expressed in mAH ). To explain this we would take two examples - one from our prior Thermometer example and, another from a more complex embedded device example.

E.g.1
Let us consider that our Hourly thermometer needs to operate for 10mS
and would consume an estimate of 10mA

Then, Active state time t(act) = 10mS
Active State Energy Time product for Thermometer = 10mA * 10mS = 100mAmS 


E.g.2
Let us consider the Active time graph of the more complex embedded device.

Here we would like to tabulate the values in order to find individual Energy Time Products and the total Active Time t(act) Shown below is the graph depicting the same.

Time(mS) Current(mA)
1 5
2 2
3 3
4 1
5 1
6 2
7 1
8 1
9 2
10 3
11 3
12 1
13 1
14 2
15 5
16 6
17 2
18 1
19 1
20 2

# Next would be the Sleep Time t(sleep):
This is the time in which the battery powered device consume the least amount of power in terms of current drawn. In general the device would try to remain in this state for the maximum of the Operating Cycle in order to minimize the power consumption. However the actual power consumed by the battery
powered device can't be zero unless batteries are taken out. So this small consumption is what would again contribute to battery life. To explain this let's see the above two examples.

E.g.1
Let us consider that our Hourly thermometer would consume 10uA of current in it's low power mode or sleep mode.

Thus, Sleep time t(sleep) = t(p) - t(act) = 3600000 - 10 = 3599990mS
Sleep Sate Energy Time Product for Thermometer = 0.01mA * 3599990mS = 35999.9 mAmS

E.g.2
For the complex embedded device we would modify the the table to grab the various consumption levels into different tasks. The new table with a column for the Energy Time Product added.

The Next parts would be covered Later, Hope that this would provide some useful information on the Low Power Calculations. Let me know your feedback on this.

Warm Regards,
Boseji
Emerging as a significant advancement in development of Super Capacitors, this is something ground breaking.

Paper thin Super Capacitor and bendable too. Makes the possibility of wearable energy storage in the near future. Catch more on this at PhyOrg.
Recently I found a trick to make my Pen Drives safe. This was to say that if you connect to an Infected PC you may be spared by warnings only. In fact as per study the majority of people who work on Windows XP operating systems are affected by this problems. I found an permanent solution to this, however this would block only the "Autorun" method of infection by the Virus. For Others you still need to be care full, as they might infect your other files.
Certain category of the Virus and Worms spread by hiding inside the "Recycle Bin" folder and installing executable code in the special file - "Autorun.inf". This file is responsible for both setting the Icons for the Pen Drive and also contains "Attach-time-Execution-instructions" for the drive. The Virus thus modifies this file to make sure that next time the pen drive is plugged into another PC the Virus can spread. My method here is simply to avoid this. In fact this has already been explained many times on the web, however I am publishing a compiled version of steps help get all in one place.

1. First we need to convert the Pen Drive file system to NTFS.
     All Widows versions after 2000 support this file system so
     there is not reason to worry.
     To proceed First Back Up all Data from the Pen Drive.
  
     To do this take the Uninfected Pen Drive!! in an Uninfected PC!!
     (This would work only before the Infection has happened)
  
     Plug it into the PC with Administrator Privileges
     (Logged in as Administrator) or the User has Admin rights.
  
    Open the Terminal Window by executing the "cmd" command
     from the Start Menu => Run.
  
     Now go to the Pen Drive " drive letter" by typing ":"
     in the Terminal.
     Suppose if my Pen Drive is connected as "H:" then I
     type "H:" and press enter

     In general the Pen Drives are formated by default as FAT32,
     but to make them safe we need to make them NTFS.
     Give the Command "convert : /FS:NTFS",
     It would warn you, give yes.
     Suppose the Drive is connected to H: then
      convert H: FS:/NTFS

      After this by keeping the Pen Drive attached, Reboot the System.
      When the Windows reboots it would configure the Pen Drive to NTFS.

2. Create the "Autorun.inf" file.
      This can be done by simply saving a Text file in Notepad in
       the Pen Drive as "Autorun.inf" .

3. Protecting the "Autorun.inf" file.
      Open a Terminal window in the way as stated earlier.
      Give the following commands in a Sequence:
       attrib -a Autorun.inf /S /D
       attrib +s +h +r Autorun.inf /S /D
       cacls Autorun.inf /c /d everyone
       Now it would ask for confirmation answer with 'y'

4. Creating Recycle Bin Folder.
      This can be performed in the same Terminal Window as above.
      Give the command: "md Recycler"

5. Protecting the Recycle Bin Folder.
      This can be performed in the same Terminal Window as above.
      Give the following commands in a Sequence:
      attrib +s +h +r Recycler /S /D
      cacls Recycler /c /d everyone
      This would ask for confirmation answer with 'y'

Now when the virus or the infected computer tries to access
this drive then there would be warning.

Hope that this helps to prevent further problems although not be full proof
but "prevention is better than cure".

The original article was taken from: Source 1 and Source 2

Warm Regards,
Boseji
MinGW, a contraction of "Minimalist GNU for Windows", is a minimalist development environment for native Microsoft Windows applications. I had know this for a long time. For many cross compilers I was using GNU gcc compiler. However my Win32 experience was mostly using the VC++ from Microsoft. I always wanted to do away the propitiatory stuff related to Visual Studio and all. The best way for hobbyists like me is to go for GNU alternatives.I tired my luck in installing and running my first program on the MinGW today.

So here goes what's we need to do:
Step1: Installation

> First we need to download the MinGW suit from Sourceforge. Fortunately unlike other GNU tools this has a good Installer feature. I downloaded the recent mingw-get-inst-20100909.exe, or which ever gets updated.

However for the installer to work an Internet connection is needed for it to download the complete packages.
Note that installation user need to be a Administrator user, or at least have Administrator rights on the PC, this is being installed. This is important since we need to also configure the path for the executable.

> After the download is complete, execute the the installer. It would ask for creation of the Software icons etc. Click next to continue

> Next it would ask for the Repository Catalogs - Select the Use pre-package repository catalogs.
Since its always better to trust the tested packages than the beta ones.

> Accept the GNU License to continue

>It would prompt to create the MinGW directory. Possibly like C:\MinGW. This can be set to another location or left as it is. We would consider it left as it is for this tutorial.

> Next comes the selection of the Program File group.

> Finally the important step the selection of the packages: Select the C++ Compiler and MSYS system if you like. However its better to install MSYS in case you need the feel of linux under windows.

> After this it opens a command prompt window to download the packages. There may be a case that the internet connection drops out. Don't worry, the install can be reinstated again and again it would start at the exact point of download it had stopped.

> If all the download is completed successfully you don't get a error message before Finish.

Now an Important step is to set the Path:
>Go to Start Menu in WinXP right click on the MyComputer and select Properties to open the "System Properties Dialog".
>Go to the Tab "Advanced" at the bottom would be button named "Environment Variables". Click this to open the "Environment variables" dialog
> In the "System Variables" list scroll for "Path" and click on Edit.
> It will already have some data, that would be default path of the system.
Concatenate to it ";" and click ok to set the path. 
Ensure that path is not accidentally over written or many things on the system would fail.
Best way it the copy it to notepad, add the required parameters and then paste it back to the Input box.


Now the PC is ready to execute the MinGW programs!!.

Step 2: First Dos Based (Terminal Based) Program

>First we need to open the Termial : Use "Start Menu" ==> "Run" Type "cmd" to open the command prompt.
> Go to the desired directory where the programs stored. For this tutorial its assumed to be at C:\MinGW\tut\ directory. So we give the command "cd c:\MinGW\tut" in the terminal
> Check the GCC version - give the command "gcc -v" it should display the version of the current GCC installed with MinGW.
> use Notepad to make you first program: For this tutorial we name it as "main.c" Below is the code:

#include <stdio.h>
#include <conio.h>
int main(void)
{
      printf("My GCC is working with MinGW");
      getch();
      return 0;
}

> Now give the first compile command: "gcc -Wall -O2 main.c -o main.exe"
  Here the "gcc" is the compiler , "-Wall" says that we need to see all the warnings, "-O2" is the Optimization directive, we have the file name to be compiled and then "-o " specifies the final "exe" (on Windows) we want to generate.
> After this you can see the file has been created named "main.exe". Double click on this to execute.
> If everything is fine then you get a small terminal window displaying "My GCC is working with MinGW", press any key to continue.
This way the simple terminal based programs can easily be made using this excellent power open source compiler.

Step3: First Windows Program

> Here is the program named as "main1.cpp"

#include <windows.h>

int WinMain(HINSTANCE,HINSTANCE,LPSTR,int)
{
  MessageBox(0,"Hello, Windows","MinGW Test Program",MB_OK);
  return 0;
} > To compile type : "gcc -Wall -O2 -mwindows main1.cpp -o main.exe"
Here the additional "-mwindows" instructs the compiler that this is a Windows application.

> Double click on the "main.exe" created. If everything works fine we would see a small message box:
 
> This is the basic Message Box api for Win32 applications.
Now lets do some advanced stuff:

Step 4: Advanced Windows based Program on Win32

> Here is the code for this named as "main2.cpp"

#include <windows.h>

char *AppTitle="Win1";
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);

int WINAPI WinMain(HINSTANCE hInst,HINSTANCE,LPSTR,int nCmdShow)
{
  WNDCLASS wc;
  HWND hwnd;
  MSG msg;

  wc.style=CS_HREDRAW | CS_VREDRAW;
  wc.lpfnWndProc=WindowProc;
  wc.cbClsExtra=0;
  wc.cbWndExtra=0;
  wc.hInstance=hInst;
  wc.hIcon=LoadIcon(NULL,IDI_WINLOGO);
  wc.hCursor=LoadCursor(NULL,IDC_ARROW);
  wc.hbrBackground=(HBRUSH)COLOR_WINDOWFRAME;
  wc.lpszMenuName=NULL;
  wc.lpszClassName=AppTitle;

  if (!RegisterClass(&wc))
    return 0;

  hwnd = CreateWindow(AppTitle,AppTitle,
    WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT,CW_USEDEFAULT,100,100,
    NULL,NULL,hInst,NULL);

  if (!hwnd)
    return 0;

  ShowWindow(hwnd,nCmdShow);
  UpdateWindow(hwnd);

  while (GetMessage(&msg,NULL,0,0) > 0)
  {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }
  return 0;
}

LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
  switch (msg)
  {
    case WM_PAINT:
    {
      PAINTSTRUCT ps;
      HDC dc;
      RECT r;
      GetClientRect(hwnd,&r);
      dc=BeginPaint(hwnd,&ps);
      DrawText(dc,"Hello World",-1,&r,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
      EndPaint(hwnd,&ps);
      break;
    }

    case WM_DESTROY:
      PostQuitMessage(0);
      break;

    default:
      return DefWindowProc(hwnd, msg, wparam, lparam);
  }
  return 0;
}
> This program would be compiled using :"gcc -Wall -O2 -mwindows main2.cpp -o main.exe"
However you might see a depreciated warning since we have the "-Wall" option.
"main2.cpp:3:16: warning: deprecated conversion from string constant to 'char*'"
Dont worry its alright to have this warning.

> Now Double click on the "main.exe" created, If every thing goes fine we see:
> That's the first Windows program with callback implemented.

But we are still not doing the things in the GCC way, create the Makefile:

#gcc -Wall -mwindows -O2 main2.cpp -o main.exe

###############################################
# COMPILER
###############################################
CC = gcc

###############################################
# EXE Environment
# -mwindows for Windows Environment
# blank for DOS environment
###############################################
EXE_ENV = -mwindows

###############################################
# File optimization level
# O0 - Level 0
# O1 - Level 1
# O2 - Level 2
# O3 - Level 3
# Os - Optimize for Size
###############################################
OPTIMISATION = Os

###############################################
# GCC Options that help in debudding
# -Wall to show all the warnings
###############################################
OPTIONS = -Wall

OUTPUT = TEST1.EXE

all: 
      $(CC) $(OPTIONS) $(OPTIMIZATION) $(EXE_ENV) main2.cpp -o $(OUTPUT)
     
clean:
      rm -f *.exe
      rm -f *.o

Now in the terminal just give the "make" command and the file magically compiles.
If you need to clean up the file just give "make clean"

I would be posting more advances soon.
Meanwhile let me know your feedback to make this article better.

Warm Regards,
Boseji

System Crash !!

Tuesday, September 14, 2010
Tag :
I had been suffering from a severe loss of my PC stability and OS lately. That's the reason I have not been able to post any thing yet. Hope that after I get through with the backup and other heuristics I would post an article on how to backup and maintain the PCs so that the situations such as mine can be avoided.  
500 Years of Science, Reason & Critical Thinking via the medium of gross over simplification, dodgy demarcation, glaring omission and a very tiny font. The map of modern science was created to celebrate the achievements of the scientific method through the age of reason, the enlightenment and modernity.


Original Source: http://www.crispian.net/CrispiansScienceMap.html
The schematics has been updated to support both 3.3V as well as 5V CAN transceivers. The MCU presently runs at 3.3V and so does the board. Filter configuration for CAN is working along with Receive and Transmit Simultaneously using different mailboxes available in the dsPIC30F4013.
Here is the Updated Schematics:

The PCB is currently under manufacture. Since I am unable to find time on evening to complete the drilling job. Hope that soon it would be ready and will post an update on the Source Forge.
Still need to check for the Battery backup needed.

Let me know your suggestion to make this project Better.
Warm Regards,
Boseji
Welcome to Boseji's Blog

Popular Post

Blogger templates

Welcome

Creation by Electronics Hobbyists from Bharat(India) to encourage & help people. This blog hosts the numerous innovations, discoveries and projects we provide.
Our Research Wing Adhar Labs
Contact Form | Email Address
We Support Open Source Hardware Definition v1.0
Creative Commons License
All works on this blog are licensed under a
Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at forbharat.wordpress.com and m8051.blogspot.com.

Permissions beyond the scope of this license may be available at http://forbharat.wordpress.com/permissions/.
Thank you for all your support.

© A.D.H.A.R Labs Research 2008-2013 . Powered by Blogger.

Follow by Email

Followers

PCB Unit Converter

mils
mm

- Copyright © Electronics for Bharat -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -