Show Posts
Pages: [1] 2 3 4
1  Topics / Product Design / Re: My first own PCB with Atmega328 (programmed with ARDUINO-IDE via programmer) on: February 01, 2014, 09:29:33 am
I want to implement Atmega328 on PCB in such a way that I can put my programmed ATMEGA#@* from UNO in PCB and can use it. I also want to do serial communication. Can you help me with the schematic please?
...maybe you should first try this :
http://arduino.cc/en/Main/Standalone
Afterwards add every IC you want to use on your PCB to the breadboard and connect it to the ATMEGA (if you want to use ICs which are not available in DIP package try to find breakout boards with those ICs!).
If everything is running you can start with the PCB-CAD!
2  Topics / Product Design / Re: Which PCB Design software should I use? on: January 24, 2014, 05:14:38 pm
...s. http://forum.arduino.cc/index.php?topic=92564.0!
3  Topics / Product Design / Re: What is the best free PCB designing application..?? on: January 24, 2014, 05:10:37 pm
...I'm using "Target3001" (there is a free version here: http://www.ibfriedrich.com/, but the commercial versions are also not very expensive). It is intuitive and easy to learn. I as a complete newbie managed to do this: as my first PCB!
4  Topics / Product Design / My first own PCB with Atmega328 (programmed with ARDUINO-IDE via programmer) on: January 09, 2014, 12:22:49 pm
...see here:
This (let's call it) gadget starts running the swingboat at least twenty minutes after the last run and then only when the PIR-sensor detects motion. Between the runs there is kind of an attract mode where randomly one out of more than 50 led animations or a peak-meter modus is choosen! At the moment the display only shows one of two randomly choosen movies (you can see both in the video) during attract mode and some simple movies with waves during the boat's run.

This is my first own circuit-board with an ATMEGA328 microcontroller (programmed with ARDUINO-IDE)!
It was a bit risky to do so, because my electronical experiences only consist of a few simple breadboard experiments (connected to an ARDUINO), but after I got my first ATMEGA on a breadboard running I was dying to do my own circuit board. So I was searching for an adequate PCB-CAD and I have been choosing TARGET3001. It is easy to learn as it's usage is quite intuitive!
The non electronical parts and the circuit-board have been designed with 3D CAD (the geometry of the circuit board has afterwards been imported to TARGET3001). The non electronical parts have been laser cutted from 4mm poplar plates.
The circuit-board uses two layers, has 78 parts, 287 pads and 458 through holes. It's main components are:

1xATMEGA328P (µc)
2xTLC59116 (led-driver)
1xl293dd (four channel driver)
1xlm386 (amp.)
1xBPW17N (phototransistor)
2xPHAP3391 (pushbutton)
1xelectret-mic
1xµOLED-96-G1 (0.96" display module with sd-card)
37xLED
1xRF300C (DC-Motor)

There is no linear regulator as the voltage of the wall wart (switching regulator) is stable enough (for my taste).
There also should be an RGB-led inside the PIR-lens, but I accidentally glued the lense to the PIR-board, so I'm not able to insert the led!
I really don't know why I didn't integrate the PIR-sensor onto my board instead of having a big hole in my board to put in an extra PIR-module!
For the led-animations I wrote a (frame based) animation program with PROCESSING that generates header files to be included to the program code.
There are more than 50 animations which don't fit into the memory of the ATMEGA, so I stored all animations on the sd-card of the display-module (which is connected via RX/TX to the ATMEGA).

If I find time I might do a new version with integrated PIR-sensor (with smaller lens), alcohol sensor, two (bigger) displays, an ARM cortex as main µc, RGB leds ("ws 28xx" with integrated driver) and again use sandwich construction, but now instead of wood, I would use plexiglas (or similar) with the electronic parts completley covered!

I might also post the circuit diagram and layout, but as I'm using a free version [PCB-POOL EDITION] of TARGET3001 which is not able to export circuit diagrams and layouts in a format that is readable by other programs, at the moment I only attached a bitmap of the pcb-layout to this post!

I have to admit that the video quality is poor, because of bad lighting/bad camera. Maybe I will upload a better video some day.

If you have questions, enhancement ideas, ..., please let me know!

For those who are interested in the pcb-layout, please find a bitmap of it attached!

5  Using Arduino / Programming Questions / Cast an array on: November 24, 2013, 11:28:19 am
...the following code
Code:
byte text[] = {0x73, 0, 0, 1, 0, 0};
((word*)text)[2] = 0xf800;
leads to text[4] = 0 and text[5] = 0xf8!
Seems that the bytes are swapped - why?

...thanks in advance!
6  Using Arduino / Programming Questions / Re: Atmega328 SRAM problems on: November 03, 2013, 10:13:53 am
Quote
there is some code knocking around for measuring free RAM too.
http://playground.arduino.cc/Code/AvailableMemory

..I used this code to determine the amount of free SRAM:
Code:
int freeRam()
{
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}
If I use that code within the main "loop" it tells me to have about 1.3 kB of free SRAM.
If I use that within the "attractMode"-function the program crashes.
If I reduce the size of the ledAnimData array from 2 * 512 to 512 (bytes) and then use the "freeRam"-function it tells me to have 554 bytes free, 42 bytes more than needed for the 2 * 512 array. That still should be enough, but is so little that it is an indication that the problems will have something to do with SRAM usage.
Seems that the ARDUINO-library functions need more space than I expected, because if I count the space that is needed by the variables which I created (global+local) in the "attractMode" function there should be 487 bytes left (with the 2*512 array), but there are only 42 bytes left, meaning that the library functions take 445 bytes!

Thanks to all of you who tried to help!
7  Using Arduino / Programming Questions / Re: Atmega328 SRAM problems on: November 03, 2013, 09:44:37 am
Don't forget all the strings consume SRAM even if the function that references them is not
currently active, they are effectively statically allocated. 
What do you mean with "strings"?
8  Using Arduino / Programming Questions / Re: Atmega328 SRAM problems on: November 03, 2013, 04:55:50 am
Based on what assumption? You have a lot of function calls going on. Each function call consumes stack space, in SRAM.
...the thing is, that each function separately, with the other one uncommented, works fine, but both together (sequentially called) do not work. When a function is quitting all space used for the local variables should be freed (stackpointer set back) so that if the functions work when used alone I can't see a reason (beside a compilation bug) why they shouldn't work sequentially called!?
9  Using Arduino / Programming Questions / Re: Atmega328 SRAM problems on: November 03, 2013, 04:34:59 am
Add to the above, you have only shown part of your code. Statements such as
Code:
Serial.print(" debug statement");
also consume SRAM.

Mark

...no, at "Reply #7" I posted the entire code (.ino-file)!
10  Using Arduino / Programming Questions / Re: Atmega328 SRAM problems on: November 02, 2013, 05:51:38 pm
...or might it still be a memory problem, because I found that if I reduce the array "shipAnimSeq[] = {..." to only four values, the program runs even without any added code (but also with added code)!
The thing is that there should be ebough memory left!?
11  Using Arduino / Programming Questions / Re: Atmega328 SRAM problems on: November 02, 2013, 05:22:22 pm
...seems that the problem has nothing to do with SRAM-problems.
I found out that if I add the following lines of code after "//Strobo----------" (line 423)
Code:
stroboWAITLOOPcontinue = 12;
stroboAnimCounter = 14;
the program runs (does not hang in line 148) -> That does not make sense!
If I add instead of the two lines the following four lines of code (which include the previous two lines) the code does hang in line 148.
Code:
if (!time)
{
  stroboWAITLOOPcontinue = 12;
  stroboAnimCounter = 14;
}
That does not make any sense, because when the program reaches line 148 it never reached the code with the added lines!
The code changes also do not change anything regarding memory usage (in my opinion)!
12  Using Arduino / Programming Questions / Re: Atmega328 SRAM problems on: November 02, 2013, 08:22:57 am
...here is the entire code!
The program crashes/hangs, when both functions ("attractMode" and "runShip") are used, at line 148 ("while (!Serial.available());"). An alternative to uncomment a whole of the two functions to make the program work is e.g. to uncomment only the part of code between "//Strobo-----------------------" and "//Schiff-Animationsende---------------------"!
13  Using Arduino / Programming Questions / Re: Atmega328 SRAM problems on: November 02, 2013, 08:06:40 am
...my problem is to understand why the Atmega328 runs out of SRAM although none of the used functions needs more than (together with the global variables) 2k of it !
I would like to post the entire code, but the code has more than the allowed number of characters!
If I could post the entire code I also could tell you the line where the CPU crashes/hangs!
14  Using Arduino / Programming Questions / Re: Atmega328 SRAM problems on: November 02, 2013, 07:28:28 am
...except when the "static"-keyword is used!?
15  Using Arduino / Programming Questions / Re: Atmega328 SRAM problems on: November 02, 2013, 07:24:22 am
...or use stack-allocated arrays.

I always thought that arrays within functions are automatically allocated on the stack!?
Pages: [1] 2 3 4