Ram usage monitoring using real performace gauge for cars

Hi everyone newbie here,

I wanna start a project to monitor my cpu ram usage. But can't seems to figure out how to make it work.
I have:

-Arduino UNO
-Oil pressure gauge for cars
-a step up transformer

Thing is,I know that the gauge requires 12V to work so I've used a transformer to get 12v from the 5v arduino board. And I'm stuck. As for the software,I manage to find one but doesn't seems to work too.

So,I'll really need some help on this

Thank you!

Thing is,I know that the gauge requires 12V to work so I've used a transformer to get 12v from the 5v arduino board

A transformer is an AC device - you need a step-up (aka boost) converter.

As for the software,I manage to find one but doesn't seems to work too.

So, you're telling us that some code we can't see is doing something that you don't want it to, but you don't want to show us the code or tell us what it is doing?

I just need the code for the arduino to work

Still not very helpful.

What has an oil pressure gauge got to do with cpu usage.

detown:
What has an oil pressure gauge got to do with cpu usage.

I think he wants to have the gauge move according to RAM usage.

Show us what you've got psikyo or we can't do much.

Just curious: what/where is the interface to the Arduino memory manager?

What "Arduino memory manager"?

AFAIK the nearest Arduino gets to memory management is the malloc() function (followed by free() or realloc() if you want your program to crash :slight_smile: ).

Graynomad:
I think he wants to have the gauge move according to RAM usage.

Show us what you've got psikyo or we can't do much.

Sorry for not being detailed.

I only got the following:

-1 12v oil pressure gauge with signal cable + cable to power the gauge.
-1 arduino uno r3 board
-a step up booster

that's all.

But I don't how to program the arduino to read from my cpu to the gauge. Sorry..I'm just a newbie here.

Graynomad:
I think he wants to have the gauge move according to RAM usage.

Show us what you've got psikyo or we can't do much.

Exactly. I want the gauge to move according to the RAm usage

To get the RAM usage you have to know the address of the top of the heap and bottom of the stack.

The top of heap can be found by malloc()ing a single byte and recording the address returned. If you are not malloc()ing in the program then this only needs to be done once.

The bottom of the stack is pointed to by the SP register, I'm pretty sure you can read that using assembly (it's been many years since I have done this), but another way is to get the address of a local variable in a function. For example

long readSP () {

    byte x;
    return (long)&x;   // not exactly the SP but close enough, probably 2 bytes off

}

Once you have those numbers you can derive the free/used RAM and use that number to control a PWM pin to move the gauge needle.

See the AvailableMemory page for the determination of the free RAM.

Graynomad:
To get the RAM usage you have to know the address of the top of the heap and bottom of the stack.

The top of heap can be found by malloc()ing a single byte and recording the address returned. If you are not malloc()ing in the program then this only needs to be done once.

The bottom of the stack is pointed to by the SP register, I'm pretty sure you can read that using assembly (it's been many years since I have done this), but another way is to get the address of a local variable in a function. For example

long readSP () {

byte x;
    return (long)&x;  // not exactly the SP but close enough, probably 2 bytes off

}





Once you have those numbers you can derive the free/used RAM and use that number to control a PWM pin to move the gauge needle.

Can you give an example?

psikyo:
I wanna start a project to monitor my cpu ram usage.

Which CPU? The one on your Arduino or the PC on your desktop?

Thing is,I know that the gauge requires 12V to work...

If it is old analog automotive gauge then I doubt it. Those things are typically a bimetallic strip. The warmer the strip gets the farther to the right the needle moves. If that's how it works than total energy is what is important.

The one on my pc. I wanna read the ram of my pc desktop.

The gauge that i have is a modern gauge that uses it on cars. Defi gauge.

A PC has no unused RAM. Almost all RAM is assigned to processes or caches, at any time.

DrDiettrich:
A PC has no unused RAM. Almost all RAM is assigned to processes or caches, at any time.

You are the only one on this thread who has mentioned "unused RAM". I suggest you find out what @psikyo actually wants.

psikyo:
The gauge that i have is a modern gauge that uses it on cars.

So it's a tiny stepper motor?

The one on my pc. I wanna read the ram of my pc desktop.

So if you open the Windows Task Manager and click the Performance tab (Win 7 for example) you get a sliding chart that shows Physical Memory Usage History and also a number with I guess "at the moment" Physical Memory, you want to show that number as a 0-100 dial gauge movement?

I don't know what it takes to get that number to pop out on the serial port for an Arduino to do something with it.

[quote author=Coding Badly link=msg=2982360 date=1477940529]
You are the only one on this thread who has mentioned "unused RAM". I suggest you find out what @psikyo actually wants.
[/quote]RAM usage in a multi-tasking system is very different from RAM usage on a small microcontroller. This shift stated in reply #13 and confirmed in #14 throws a very new light on the thread. The remaining Arduino aspect is the control of the gauge, the PC part deserves further clarification.