Atmega8 necessary circuit for standalone working - arduino

I am developing a project to monitor solar voltage and battery voltage by displaying them on an LCD. I programmed an Atmega8 with an arduino. When I attached the LCD with the board it worked pretty well. So I detached it from board and made a breadboard circuit as described on this page.
It didn't work this time. I checked all the connections many times but could not get to any point. Kindly guide me how to make a standalone atmega8 circuit to display something on an LCD.

Start slowly. There are some pitfalls when migrating to your own design (and yes, there's another forum for that). If you're using an external crystal oscillator, make sure that you've programmed the Atmel chip to use it by programming the appropriate fuse bits. After that, look to see if you can toggle a single output of the device. Ideally with a single LED connected, so you can see if the output port is changing state.
Some LCD controllers can require relatively precise timings, so if you have a logic analyser you can examine the waveforms. Otherwise, check your clock timing by turning on and off an LED every ten seconds (or so) and use a stopwatch to count ten or twenty of the LED flashes. You can see what your clock speed is working out to be, and verify that it's the right clock, etc.

You need to program the fuses correectly for standalone operation when no crystal is attached (Arduino has an external crystal) Hence, for running an Atmel using the internal clock, the clock fuse needs to be programmed correctly. In the datasheet you will find the description.

Related

atmega32u4 Failed to enter programming mode

I have designed a custom board using atmega32u4 with a few other components (Such as RTC, memory and etc) but left them empty to test if the microcontroller can be programmed. After just hand soldering the microcontroller and the necessary capacitors and resistors, ATMEL Studio can't read device signature.I'm using AVRISP MKII. This board was inspired by ARDUINO ProMicro in design. The things I tried to solve it:
Measure all 3.3 volt supply lines and all of the grounds. (They all correspond with PCB and schematic)
Checked SPI lines to see if microcontroller receives commands from the programmer by using oscilloscope.
I tried removing the 16MHZ crystal, still the same.
I reflowed the microcontroller since it is a QFN type (atmega32-MU package) and I have a few via holes under the micro for flux to come out.
I have properly washed the board after reflow.
I have AREF grounded with a 0.1uF capacitor and !HWB pin (PE7) is left empty. I didn't ground it.
I tested the programmer with an actual promicro board and it programs fine.
I think I'm missing something but I don't know what... I'd be grateful if you guys could help me. Attached is the schematic of the circuit.
The micro controller RESET is indicated by MICRO RST on pin 13. That RESET on PB4 is for another device which is not populated yet and left empty, I checked Pin 13 with Oscilloscope and it seemed working fine and going to zero at the first moment of programming. Also MISO and MOSI and SCK were sending signals to the relevant pins.
Thanks
If you are programming the board with ISP you have to connect RESET to the programmer. otherwise the controller could not be programmed!
Image from microcontroller.net
It seems that your RESET is on PB4 but for programming it should be connected to RESET of uC.
So, I realized the problem after almost a month! I had removed the 16MHz crystal from the circuit and this caused the problem with programming. Now, after placing the crystal the program is successfully uploaded to the ATMEGA32U4.

PWM/PPM Output misses some edges

I am using ESP8266 (NODEMCU 3.0 or something) to make a quadcopter. Ive connected ardu pro mini to RC receiver so I am reading PPM values from it. Pro mini sends data with tx to ESP8266. ESP reads it with software serial with 115200 baudrate. I am communicating with MPU9255 (Waveshire) via I2C either.
My problem is that I cant fully controll my brushless motors. When I was using arduino instead of ESP8266, servo library was the best and reliable. But ESP's servo library is different, since its not AVR, and problems occurs. First of the servo library didnt want to work on most frequencies. I mean default is 50Hz (20000uS) and in this state ESC of motors did armed but unfortunatelly when changes was fast and short (1250-> 1370 -> 1250) it did miss that change like nothing happnd... This makes my D value in PID controller useless...
Sometimes on 100Hz freq all was working fine, but sometimes not...
When Ive started to use analogWrite only 500Hz was working fine, rest of freq didnt want to arm ESCs.
PS. I am using 3.3V to 5V converter for PPM/PWM pins so I am sure that the signal is fine for ESCs.
PS2. I dont have any osciloscope unfortunately.
The ESP82266 present on your module is a RF transceiver integrated circuit that can handle WiFi communication, both configured as a slave to a microcontroller such as the ones present on various Arduino boards, or as a standalone chip by having it's on-board Tensilica L106 32-bit processor programmed via an external SPI flash memory. If used as a slave, the communication between, for example, an Arduino an the ESP82266 can be done using different protocols such as SPI / SDIO or I2C / UART interfaces. Googling a comprehensive Tensilica L106 user guide on the internet doesn't seem an easy task, and it looks as if some people have already failed to find it. If you're seeking to add Wi-Fi capabilities to your quadcopter the solution I suggest is having the Arduino take control over the servos, motors, etc. and hand off messages via SPI to your ESP82266 module. If this isn't the answer you are looking for, please try to be clearer about it, maybe find someone to do as an English translator for you.
However, if this is what you're concerned about, and you would like to use the ESP82266 module as as standalone solution, please link its built-in processor datasheet and the relevant parts of the quadcopters code that might need debugging.

Arduino: Using the watchdog for both preventing failures and energy savings

I came across this website when trying to find a reliable way to use the watchdog for preventing failures (code lock ups) and saving battery using an Arduino.
I tried the code and it worked fine. However, i would also like to use the serial monitor. I tried adding Serial.begin(9600); in the setup, however, most of what is shown in the serial monitor (from the code within the main loop) are strange characters (the baud rate is set to 9600). Is this something to do with the function to configure the wdt and the placement of Serial.begin(9600) in the code?
I'd also like to use an external interrupt (via a button on Digital pin 3) to wake the board from sleep. How can be achieved based on the current code? I know how to implement using a different method of making the board go to sleep without using any watchdog at all, however, i have been unsuccessful in making it work with this code.
Many thanks for any help.
As said above, the serial communication should work fine. Are you sure you are able to make your serial communication work fine without the watchdog part of the code? I have used the watchdog tips given on the website along with serial communications without any problem on Arduino Uno, so I would guess the serial communication problem lies somewhere else in your code.
Can you write a bare bone example of your code with the watchdog management part, a serial communication or two somewhere in your loop(), and if you want some delays / infinite loops to test the watchdog firing, post it here, test it on your board and indicate if / where you have problems?
I have never used a pin interrupt, but it seems that google gives some nice results with example code. Have you tried the results given by google?
https://www.arduino.cc/en/Reference/AttachInterrupt
http://www.allaboutcircuits.com/technical-articles/using-interrupts-on-arduino/
You will have to be careful regarding the choice of the pin on which you put the interrupt, as explained in the Arduino Reference only pins 2 and 3 support interrupt on the Uno.

ATmega 48 Development board - 7 segment display

I got this development board,
ATMEGA48/88/168/8 AVR Training / Development Board Kit (MC-AVR-48-01)
and I have no idea how to turn on the built-in 7-segment display. Only thing I know is this model/code number and link I have found on Google.
How do I use this display?
There doesn't seem to be a lot of information about this particular board on the internet.
Assuming you don't have a schematic you could
use a multimeter to find out which IO pins the 7-segment display is connected to on your µC (if any - it could be not directly connected)
flash your controller with a little program that writes to its IO ports and see whether this turns on any display segments or changes the voltage level on the display pins

Arduino Standalone

I have an Arduino Uno and I am using arduino 1.0.5 IDE. I followed he procedures for bootloading an atmega328P-PU on a breadboard.
I uploaded the ArduinoISP sketch first, made the connections(using the External Oscillator) and then wired it up. Then, I selected the programmer as Arduino as ISP, selected the board as Arduino duemilanove w/ Atmega328P. Then I selected the correct serial port and clicked Burn Bootloader.
I got the following errors:
avrdude.exe: stk500_program_enable(): protocol error, expect=0x14,
resp=0x50avrdude.exe: initialization failed, rc=-1 Double
check connections and try again, or use -F to override
this check.avrdude.exe: stk500_disable(): protocol error, expect=0x14,
resp=0x51
How to solve this issue? Also, can I upload the bootloader directly by using it on the Uno in place of the original chip. If so, how?
to my understanding the error you have indicates a bad reading from the chip. I experienced that with chips that were either dead or not properly connected, especially to power supply.
You may find more detailed information in th tutorial : https://www.arduino.cc/en/Tutorial/ArduinoISP
Especially those things :
Note for Arduino 1.0: you need to make one small change to the
ArduinoISP code. Find the line in the heartbeat() function that says
"delay(40);" and change it to "delay(20);".
Select the items in the
Tools > Board and Serial Port menus that correspond to the board you
are using as the programmer (not the board being programmed).
Instead of arduino built-in boot loader just go through below link and it will be great for uploading boot loader and verifying board status info
I am replying you this because same issue I got long back and it saved me.
One more thing for arduino boot loader: for atmega328 you need to put capacitor between reset and gnd( in case you missed)
For gammon bootloader you don't need it.
Be Innovative.
For reset line you might me using 100nf(thats what stated in documentation )...but sometimes it doesn't work...try something like 4.7uf, 22uf or 47uf or close values
I had a similar problem and the issue was that my programmer was a bit slow, I used the -B flag for avrdude to slow down the bitrate and it started working, I set the -B20 and works like a charm every time, but I use the USBTinyISP programmer, not the stk500 one, so this might not work for you.
In case someone stuck at this as I did and nothing like changing the cap value helped. Make sure you are using your USB-TTL adapter in a 5v mode (obviously for a 5v powered chip). I always used it in a 3.3v mode in order not to accidentally burn my 3.3v chips and it always worked. Until today, I was trying to flash my custom atmega8 board and everything worked with the ISP but I was having a hard time using the bootloader and after half a day searching and trying different stuff the 5v setting to the rescue.

Resources