Show Posts
Pages: [1] 2 3 ... 133
1  Using Arduino / Storage / Re: RamDisk - a file system library for RAM devices like 23LCV1024 on: April 12, 2014, 06:24:31 pm
FYI - these are results with 8MB Ramdisk1.1 (atmega1284p @16MHz, 3.3V), driver bitbanging (see above). Mind the bitbanging is slow with atmega.  The ramdisk performs best as a block device, with larger chunks to be wr/rd. External Memory Bus on Due might be a better choice.
Code:
FreeRam: 15795
Format (Y/N): Y

File read/write stats
fileSize: 51000
write millis: 1680
read millis: 1454

Stream getc/putc stats
putc millis: 147
getc millis: 181
streamSize: 51000
Done!
--------------------------
Type any character to start
uint8_t 0 to 255, 100 times
fileSize: 116500
print millis: 5619
stdio millis: 588
ratio: 9.56

uint16_t 0 to 18000
fileSize: 114890
print millis: 5383
stdio millis: 627
ratio: 8.59

uint32_t 0 to 18000
fileSize: 114890
print millis: 5377
stdio millis: 731
ratio: 7.36

uint32_t 1000000000 to 1000010000
fileSize: 120000
print millis: 5459
stdio millis: 932
ratio: 5.86

float nnn.ffff, 10000 times
fileSize: 100000
print millis: 8857
stdio millis: 1618
ratio: 5.47

Done
------------------------
Format (Y/N): Y
clusterCount: 250
Starting test
t: 7.32 sec
minMicros: 40
maxMicros: 120
avgMicros: 41
sync micros: 100
filesize: 120000

pin0,pin1,pin2,pin3,pin4
0,0,0,0,13
0,0,0,0,1
0,0,0,0,0
0,0,0,0,1
0,0,0,0,1
0,0,0,0,0
0,0,0,0,0
0,0,0,0,13
0,0,0,0,17
0,0,0,0,68
Done
---------------------
FreeRam: 14772
Format (Y/N): Y

Special float values differ:
Arduino -INFINITY, -NAN, -1e11, 1e11, NAN, INFINITY
inf
nan
ovf
ovf
nan
inf
Stdio -INFINITY, -NAN, -1e11, 1e11, NAN, INFINITY
-INF
NaN
-OVF
OVF
NaN
INF

fileSize: 406
files verify
Done![/size]
2  Using Arduino / General Electronics / Re: arduino as ammeter on: April 09, 2014, 05:19:25 am
For example (just an idea, needs fine tuning may be). The low offset op-amp type is just an example.
Arduino is isolated from the power lines by a separate battery. Do not connect Arduino GND and power GND together !
Op-amp's +5V and -5V comes from Arduino battery as well.
3  Using Arduino / General Electronics / Re: arduino as ammeter on: April 09, 2014, 04:44:34 am
What is the problem with measuring the 1200A with the shunt?
50mV to measure is easy - an low noise opamp (you must use +5V and -5V power for the opamp) with amplification set to ~50 will do that. You will get 0-2.5V for 0-1200A, for example. Filter the input voltage a little bit and that is all.
You need a DC-DC converter to get -5V and a single opamp, 2-3 resistors, 2-3 capacitors.

You may isolate the whole stuff by a separate battery (so the only wires will go to the voltage terminals of the shunt - use shielded cables) and send the data to your truck control center via Bluetooth smiley
4  Using Arduino / General Electronics / Re: arduino as ammeter on: April 08, 2014, 03:35:52 am
Quote
small correction, i have a 1200A, not 1500A, shunt. not that it's gonna matter anyhow.
it had stamp of 50mV and i was thinking it was good for input to ic but it reads .4 ohm so i don't believe i will be using it.
the 200A is stamped 75mV with .3 ohm on DMM. fat chance to use that also.
You mean 120A probably.
A 120A shunt for 50mV full range reading has R=0.0004 ohm
A 200A shunt stamped 75mV has R=0.000375 ohm
You cannot measure resistance of those shunts with your DMM that way, I am afraid..
5  Using Arduino / General Electronics / Re: 10k-ohm resistor in chapter 2 of arduino projects book on: April 07, 2014, 03:01:04 pm
It is called a "pull-down" resistor. When the button is not pressed it keeps the input of arduino at 0V ("down").
Otherwise, the input of the arduino will float between 0-5V randomly, or it will stay at 5V when the internal pull-up is activated (pull-up is a resistor wired from input to +5V)..
6  Using Arduino / Microcontrollers / Re: AnalogRead - readings are erratic on: April 07, 2014, 02:34:53 pm
Quote
101, 102, 101, 101, 102, 101, 101, 101.
Is this normal for a strain gauge?
That is normal with ADC.
7  Using Arduino / General Electronics / Re: arduino as ammeter on: April 07, 2014, 02:22:50 pm
Quote
If the shunt is 0.01Ω, however, that would equate to 2V
.. and 400W of heat as well  smiley-razz

Typical 150A shunt I hold in my hand 2w ago was made of 3 parallel 3-4mm diameter brass alloy wires (~80mm long), soldered to two 25x25mm 4mm thick copper holders equipped w/ M8 bolts with M8 screws for current and M3 bolts and screws for voltage measurement. It gave 60mV @150A.
8  Development / Other Hardware Development / Re: 8MB Ramdisk (external RAM) for Arduino.. on: April 05, 2014, 10:01:29 am
With DUE this is an Example how to proceed with 8MB Ramdisk on the DUE's External Memory Bus (just fragments of a code here, needs to be put into your code):
Code:
// DUE timing settings and Examples for 8MB Ramdisk
// Pito 4/2014
// Examples only, not tested
// Library used: https://github.com/delsauce/ArduinoDueParallel
// DUE at 84MHz (12ns clock)
// No warranties of any kind

// Wiring:
RDisk DUE (EMB signal names)
================
D0-D7 D0-D7
/WR NWE
/RD NRD
/DATA A0

// Configure parallel bus for 8bits, no CS, A0, and NRD and NWE
Parallel.begin(PARALLEL_BUS_WIDTH_8, 0, 1, 1, 1);

// Configure bus timings.. EXPERIMENTAL (assumption: WR pulse could be shorter than RD pulse)
// Otherwise WR=RD timing
// We do not use any real addressing
Parallel.setAddressSetupTiming(0,0,0,0);
// NWE, NCSWE, NRD, NCSRD  - we do not use NCSs
Parallel.setPulseTiming(5,0,8,0); // or (4,0,7,0) or (6,0,9,0)
// better read datasheet for CycleTiming:
Parallel.setCycleTiming(6,9);  // or (5,8) or (7,10)


// Setting of the starting Address (8MB max)
set_address(uint32 Address){
// below sequence could be shorter when setting only some upper nibbles
MAKE NIBBLES OF Address SOMEHOW - ie. with union as above or with >>
Parallel.write(0x01, nibb6);  // addr[23..20]
Parallel.write(0x01, nibb5);
Parallel.write(0x01, nibb4);
Parallel.write(0x01, nibb3);
Parallel.write(0x01, nibb2);
Parallel.write(0x01, nibb1);  // addr[3..0]
//Parallel.write(0x01, CONTROL);  // 0x00 default, 0x01-autodecrement, 0x02-wrprotect, 0x03-both
}

// Write 1MB of data=0xAA from Address=0x2FFFFF
set_address(0x2FFFFF);
for(uint32 i=0; i<1MB; i++){
Parallel.write(0x00, 0xAA);
}

// Read and sum 1MB of data from Address=0x2FFFFF
uint32 sum = 0;
set_address(0x2FFFFF);
for(uint32 i=0; i<1MB; i++){
sum = sum + Parallel.read(0x00);
}

// Fast reset of the Address to 0x000000
reset_address(){
Parallel.read(0x01);
}

// Example: addressing of a 65kB large Block
// Max 128 Blocks of 65KB each with 8MB Ramdisk, a pity
set_block_address(uint8 BlockNumber){
Parallel.write(0x01, BlockNumber>>4);  // addr[23..20]
Parallel.write(0x01, BlockNumber);  // addr[19..16]
}

// set the Address at the beginning of the Block N.6
reset_address();  // Address is 0x000000 now
set_block_address(0x06); // set 2 highest nibbles only - the Block number
// Write 65kB of data=0xAA into the block N.6
for(uint32 i=0; i<65kB; i++){
Parallel.write(0x00, 0xAA);
}

// set the Address at the beginning of the Block N.6
reset_address();  // Address is 0x000000 now
set_block_address(0x06); // set 2 highest nibbles only - the Block number
// read and sum 65kB worth of data from the block N.6
uint32 sum = 0;
for(uint32 i=0; i<65kB; i++){
sum = sum + Parallel.read(0x00);
}
9  Using Arduino / Project Guidance / Re: Extra SRAM for arduino DUE on: April 03, 2014, 05:01:45 pm
The 8MB ramdisk is also a serial RAM, but with 8bits data width smiley

http://forum.arduino.cc/index.php?topic=220918.0
I do not have DUE handy, but based on the numbers I've seen in an another topic on Due's External Memory Bus I guess 10MB/sec is doable. There is a filesystem working on the ramdisk too.

Code:
RDisk DUE
================
D0-D7 D0-D7
NWR NWE
NRD NRD
NDATA Ax
10  Using Arduino / Audio / Re: Replacement for TBA820M audio amplifier chip on: April 02, 2014, 04:13:39 pm
LM380N-8
11  Using Arduino / Audio / Re: Reducing static from volume control digipot on: April 02, 2014, 03:31:43 pm
The C32 - make it larger - ie 10uF-100uF (and leave the 47nF there).
I think your problem is decoupling generally.

Not sure 470uF at 12V is enough. Also you have none larger capacitor at 5V. You have to use a separate regulator for the 5V audio section - mixing digital and analog at the same 5V rail is not a good idea.
For audio app I would add a simple RC filter at 5V regulators inputs (first one for the atmega, the second one for the op-amp) for example 50ohm/470uF.

Quote
The TPA3122D2 is a high-performance CMOS audio amplifier that requires adequate power supply decoupling
to ensure that the output total harmonic distortion (THD) is as low as possible. Power supply decoupling also
prevents oscillations for long lead lengths between the amplifier and the speaker. The optimum decoupling is
achieved by using two capacitors of different types that target different types of noise on the power supply leads.
For higher frequency transients, spikes, or digital hash on the line, a good low equivalent-series-resistance (ESR)
ceramic capacitor, typically 0.1 uF to 1 uF placed as close as possible to the device VCC lead works best. For
filtering lower frequency noise signals, a larger aluminum electrolytic capacitor of 220 uF or greater placed near
the audio power amplifier is recommended. The 220-uF capacitor also serves as local storage capacitor for
supplying current during large signal transients on the amplifier outputs. The PVCC terminals provide the power
to the output transistors, so a 220-uF or larger capacitor should be placed on each PVCC terminal. A 10-uF
capacitor on the AVCC terminal is adequate.
..
Because the TPA3122D2 is a class-D amplifier that switches at a high frequency, the layout of the printed-circuit
board (PCB) should be optimized according to the following guidelines for the best possible performance.
· Decoupling capacitors—The high-frequency 0.1uF decoupling capacitors should be placed as close to the
PVCC (pins 1 and 10) and AVCC (pins 16 and 17) terminals as possible. The VBYP (pin 6) capacitor and
VCLAMP (pin 9) capacitor should also be placed as close to the device as possible. Large (220 uF or
greater) bulk power supply decoupling capacitors should be placed near the TPA3122D2 on the PVCCL and
PVCCR terminals.
· Grounding—The AVCC (pins 16 and 17) decoupling capacitor and VBYP (pin 6) capacitor should each be
grounded to analog ground (AGND, pins 7 and smiley-cool. The PVCCx decoupling capacitors and VCLAMP
capacitors should each be grounded to power ground (PGND, pins 11 and 20). Analog ground and power
ground should be connected at the thermal pad, which should be used as a central ground connection or star
ground for the TPA3122D2.
· Output filter—The EMI filter (L1, L2, C9, and C16) should be placed as close to the output terminals as
possible for the best EMI performance. The capacitors should be grounded to power ground.
12  Using Arduino / Storage / Re: More memory to save data on: April 02, 2014, 11:56:33 am
Quote
So can you guys please suggest anything else?
I would recommend you to reread this topic again. Maybe you have to have a look at other topics as well..  smiley-wink
13  Development / Other Hardware Development / Re: 8MB Ramdisk (external RAM) for Arduino.. on: April 02, 2014, 03:56:02 am
When you need to set the Address to 0 (for example when always writing/reading a buffer from ramdisk's zero Address) you may use this shortcut:
Code:
// reset the Address to 0x000000L
inline void resetadr (){
NDATA = 1;  // address mode
NRD = 0;  NRD = 1;
NDATA = 0;  // data mode
}

Moreover, you can stop writing the Address nibbles after any nibble written  smiley-razz, thus  you may write in only "required" number of Address nibbles (1 or 2 or 3 or 4 or 5 or 6).

That allows to speed up with setting the Address, for example you work with 128 blocks 65kB each, so you must not set all 6 nibbles of the 8MB Address, but only top 2:

Code:
// Load the BLOCK Address into the RAMDISK
// a BLOCK is a 65kB large chunk of ram starting at 0x0000
inline void ldadr_block65k (unsigned char addr)
{
NDATA = 1;  // address mode
// the trick with zeroing the 24bit address
NRD = 0;  NRD = 1;
// now load the 2 nibbles of the BLOCK address
DDRA = 0xFF; // sets Data output
PORTA = (addr >> 4); // 6th nibble of the address - the highest
NWR = 0; NWR = 1;    //
PORTA = (addr); // 5th nibble of the address
NWR = 0; NWR = 1;
// 4th, 3rd, 2nd, 1st nibble are zero - here we start to read/write
DDRA = 0x00; // sets Data input
NDATA = 0;  // data mode
}

With a standard external HW SRAM buses on DUE or PIC32 or others, you may simply write the 24bit Address with A0=1 (when for example you use A0 address line) and then you read/write all the Data bytes from A0=0. You must not mess with bit-banging the /RD and /WR signals, or with the setting of a 8bit Data port direction - that is done by the MCU's external memory bus for you (EMB on DUE, PMP on PIC32, FSMC on STM32, etc.). You have to set the timing of the /RD and /WR signals as required, however.

For example - a pseudo-code:
Code:
//write 24bit Address, A0=1
bus_write(1, 6th_nibble); //the highest
bus_write(1, 5th_nibble);
bus_write(1, 4th_nibble);
bus_write(1, 3rd_nibble);
bus_write(1, 2nd_nibble);
bus_write(1, 1st_nibble);
// write 100000 bytes of Data (w/ auto-increment)
for i=1 to 100000
bus_write(0, data[i]);
next i

or

// read 100000 bytes of Data (w/ auto-increment)
for i=1 to 100000
data[i] = bus_read(0);
next i

When working with blocks (see above):
Code:
//write 8bit BLOCK Address (up to 128 BLOCKS each BLOCK 65kB large)
dummy = bus_read(1);  //resets Address to zero (0L)
bus_write(1, 6th_nibble); //the highest
bus_write(1, 5th_nibble);
// write 65kBytes of Data (w/ auto-increment)
for i=1 to 65536
bus_write(0, data[i]);
next i

or

// read 65kBytes of Data (w/ auto-increment)
for i=1 to 65536
data[i] = bus_read(0);
next i

You may connect the 8MB Ramdisk to your DUE via DUE's External Memory Bus easily:
Code:
With Ax = 1 you write in the 24bit starting "Address"
With Ax = 0 you write/read the Data bytes sequentially from the "Address"
You may use any DUE address line.
14  Products / Arduino Due / Re: Parallel library for Due External Memory Bus/Static Memory Controller on: April 02, 2014, 03:39:49 am
You may connect the 8MB ramdisk to your DUE via the External Memory Bus (Static 8bit memory) - http://forum.arduino.cc/index.php?topic=220918.0
Code:
RDisk DUE (EMB signal names)
================
D0-D7 D0-D7
NWR NWE
NRD NRD
NDATA Ax

With Ax = 1 you write the 24bit starting address of a block
With Ax = 0 you write/read the bytes sequentially from the address

Quote
memcpy speed in MiB/s
int to int 76.59
int to ext 19.88
ext to ext 8.63
ext to int 13.40
Based on that figures you can achieve 11-12MiB/sec with the above 8MB Ramdisk for Read and ~15MiB/sec for Write..

15  Using Arduino / Storage / Re: RamDisk - a file system library for RAM devices like 23LCV1024 on: April 01, 2014, 04:45:49 pm
Performance (5MB bench test) of the 8MB ramdisk with RamDisk file system - buffer size vs. rd/wr speed vs. "latency - buffer copy time".
Below picture with atmega1284p @16MHz and bitbanging (slow). Will be much better with DUE and its External Memory Bus (8bit static device) - I would guess 11-12MB/sec with DUE is feasible.
Pages: [1] 2 3 ... 133