Hello All,
I have an Arduino UNO with a working script. I then made an Arduino on a protoboard and placed the ATMEGA328 into the 28 pin dip on the protoboard. I also made a voltage regulator and added that to the protoboard a 7805 12 to 5v.
I then gave the protoboard 12v from a bench power supply.
Problem: So far I get 5v readings on some of the digital pins but not all. I am confused about the pins from the Arduino compared to the Atmega328.
I plan on running two 12v, 3a fog lights on my Harley Davidson, I will be adding a N channel MOSFET later on the protoboard to handle the 12v fog lights
I know that is why I used a voltage regulator to drop the 12v to 5v tor the atmrga328. I need 12 v to power my fog lights with an N channel MOSFET I will add later. The 12 on pin 1 was there with this setup. I am not familiar with the atmega328.
I have a working circuit with the fog lights using an attiny with a blink sketch on it. I want to blink my foglights with a mom-on button at will. It all works.
Why do you expect 5v on the digital pins? They will only be 5v if your code is setting them to logic HIGH. Is that what your code does?
Also - GPIO pins 5 & 8 (ATMEGA328 pins 11 & 14) look like they are being used as button inputs... so they will only high if they are being pulled high (INPUT_PULLUP), as they don't seem to be connected to anything - maybe this is done in the KTS_Button library?
I think you are getting confused between the GPIO PIN numbers and the physical pins of the IC. The GPIO PIN numbers are what you use in your code… these won’t change whether you use the Uno or the Atmega328 directly.
You just need to ensure when using the Atmega328 you connect your buttons and LEDs to the correct physical pins. On the Uno the labelling on the header refers to the GPIO numbers to make connecting easier.
I feel dumb, I still don't get it, could you tell me where I would connect button 4 if not on pin 6 on the atmega328. Isn't pin 6 on the atmega328 the physical pin to pin 4 on the UNO? Please give me some examples using my pins, sorry to be a pain.
Yes.. physical pin 6 is GPIO pin 4... but that doesn't mean you need to change your code - your code ALWAYS refers to the GPIO PIN number.
You just need to know that GPIO pin 4... is physical pin 6 on the ATMEGA328 when you are wiring your circuit. So you would connect your button to pin 6... but you still refer to it in the code as pin 4.
So these will stay the same...
Sometimes the chips get labelled like this so it is easier to figure out what physical pins relate to which GPIO pins.
Usually with a vehicle electrical system, where accessories are grounded directly to the chassis, P channel mosfets are a better choice. However, these are slightly more difficult to use because they have to be configured as a high side switch requiring an additional NPN transistor or N channel mosfet.