Difference between revisions of "Programming Power Fail Logger with Arduino IDE"

From media_wiki
Jump to: navigation, search
Line 1: Line 1:
Flash the Microcontroller with Power-Fail-Logger Program
+
'''Flash the Microcontroller''' with '''Power-Fail-Logger''' Program
 
 
Connect the '''USBTinyISP''' to the '''AVR-ISP-6 pin header J7''' on the '''Power Fail Logger PCB''' .<br>
 
In the Arduino IDE click on '''Tools''' Tab - Select '''Programmer''' then select '''USBTinyISP'''.<br>
 
In the Arduino IDE click on '''Sketch''' Tab - Select '''Upload Using Programmer'''<br>
 
Program should download. <br>
 
  
 
Prolific USB-to-Serial Comm Port
 
Prolific USB-to-Serial Comm Port
  
'''Setting up the ATMega328 chip'''
+
'''Test the connectivity from the programmer to the Power Fail Logger board'''
   Plug the USBTiny Programmer into the AVR-ISP 6 pin header J7.
+
   Connect the '''USBTinyISP''' to the '''AVR-ISP-6 pin header J7''' on the '''Power Fail Logger PCB''' .
 
   Using AVRDUDE Validate the USBTiny is communicating with the Power Fail Module Microcontroller
 
   Using AVRDUDE Validate the USBTiny is communicating with the Power Fail Module Microcontroller
    
+
   On laptop using Windows CMD type the following. Make sure you are in the AVRDude directory.
 
   '''avrdude -c usbtiny -p m328p -v'''
 
   '''avrdude -c usbtiny -p m328p -v'''
 
    
 
    
   The Microcontroller is set to 1HMz and needs to be changed to '''16 MHz Default'''
+
For more information about using AVRDude refer back to this link
   Using AVRDude enter the follow command to set the fuse bits on the Microcontroller.
+
  ==[[ AVRDUDE Class]]==
 +
'''Connect Serial Port to the RS232 Port'''
 +
   Using a '''Prolific USB-to-Serial Comm Port''' Plugged into your USB Port.
 +
  Connect the '''TX''', '''RX''', and '''Ground''' Pins to '''J4''' on the '''Power Fail Logger Board'''.
 +
          Prolific        J4 Power Logger
 +
              TX      -    RX
 +
              RX      -    TX
 +
              GND    -    GND
 +
  Use Windows '''Device Manager''' to validate which Comm Port is used.
 +
 
 +
'''Set up Programmer'''
 +
  Connect the '''USBTinyISP''' to the '''AVR-ISP-6 pin header J7''' on the '''Power Fail Logger PCB'''.
 +
  In the Arduino IDE click on '''Tools''' Tab - Select '''Programmer''' then select '''USBTinyISP'''.<br>
 +
   Connect the '''Prolific USB-to-Serial Comm Port''' to the '''RS232 Port''' on the Power Fail Board
 +
  Use '''Device Manager''' to validate which Comm Port is used.
 +
  In the Arduino IDE click on '''Tools''' Tab - Select '''Port''' then select the '''Prolific Port''' (Example Comm6).<br>
 +
  Select correct target board
 +
  In the Arduino IDE click on '''Tools''' Tab - Select '''Board''' then select the '''Arduino Uno'''.<br>
 +
 
 +
'''Flash the Microcontroller''' with '''Power-Fail-Logger''' Program
 +
  Paste the above program '''Power-Fail-Logger Program.ino''' into the '''Arduino IDE'''.
 +
  In the '''Arduino IDE''' click on '''Sketch''' Tab - Select '''Upload Using Programmer'''
 
    
 
    
 +
'''Validate the Power-Fail-Logger Program is running''' 
 +
  After program has uploaded  Validate
 +
  In the Arduino IDE click on '''Tools''' Tab - Select '''Serial Monitor'''<br>
 +
  Once the program has finished loading hit the Reset button on the Power Fail Logger Board.
 +
  You should see the correct time and date display in the Serial Monitor.
 
    
 
    
  '''avrdude -p m328p -c usbtiny -v -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0xFF:m''' 
 
 
 
  Make sure it matches these settings:
 
 
  '''avrdude: safemode: hfuse reads as DE'''
 
  '''avrdude: safemode: efuse reads as FF'''
 
  '''avrdude: safemode: Fuses OK (E:FF, H:DE, L:FF)'''
 
  '''avrdude done.  Thank you.'''
 
 
For more information about using AVRDude refer back to this link
 
  ==[[ AVRDUDE Class]]==
 
  
Next step '''Setting up the DS3231 RTC'''  
+
Next Step '''Set up the SD Card reader'''  
 +
 
 +
==[[ Power Fail Logger by Microrusty ]]==
 +
 
  
 
==[[Setting Time and Date for the DS3231 RTC]]==
 
==[[Setting Time and Date for the DS3231 RTC]]==

Revision as of 22:26, 25 May 2021

Flash the Microcontroller with Power-Fail-Logger Program

Prolific USB-to-Serial Comm Port

Test the connectivity from the programmer to the Power Fail Logger board

 Connect the USBTinyISP to the AVR-ISP-6 pin header J7 on the Power Fail Logger PCB .
 Using AVRDUDE Validate the USBTiny is communicating with the Power Fail Module Microcontroller
 On laptop using Windows CMD type the following. Make sure you are in the AVRDude directory.
 avrdude -c usbtiny -p m328p -v
 
For more information about using AVRDude refer back to this link 
 ==AVRDUDE Class==

Connect Serial Port to the RS232 Port

 Using a Prolific USB-to-Serial Comm Port Plugged into your USB Port.
 Connect the TX, RX, and Ground Pins to J4 on the Power Fail Logger Board.
         Prolific         J4 Power Logger
             TX      -    RX
             RX      -    TX
             GND     -    GND
 Use Windows Device Manager to validate which Comm Port is used.

Set up Programmer

 Connect the USBTinyISP to the AVR-ISP-6 pin header J7 on the Power Fail Logger PCB.
 In the Arduino IDE click on Tools Tab - Select Programmer then select USBTinyISP.
Connect the Prolific USB-to-Serial Comm Port to the RS232 Port on the Power Fail Board Use Device Manager to validate which Comm Port is used. In the Arduino IDE click on Tools Tab - Select Port then select the Prolific Port (Example Comm6).
Select correct target board In the Arduino IDE click on Tools Tab - Select Board then select the Arduino Uno.

Flash the Microcontroller with Power-Fail-Logger Program

 Paste the above program Power-Fail-Logger Program.ino into the Arduino IDE.
 In the Arduino IDE click on Sketch Tab - Select Upload Using Programmer
 

Validate the Power-Fail-Logger Program is running

 After program has uploaded   Validate 
 In the Arduino IDE click on Tools Tab - Select Serial Monitor
Once the program has finished loading hit the Reset button on the Power Fail Logger Board. You should see the correct time and date display in the Serial Monitor.

Next Step Set up the SD Card reader

Power Fail Logger by Microrusty

Setting Time and Date for the DS3231 RTC


Power Fail Logger by Microrusty