Programming a ATMGEGA 328P chip

Discussion in 'Programmer's Corner' started by Jonlate, Feb 14, 2018 at 12:25 PM.

  1. Jonlate

    Thread Starter New Member

    Dec 21, 2017
    16
    0
    Hi everyone, especially if you live in Ireland!!

    Can anyone in Ireland program this chip for me and then post it to me?

    As previously posted I want to create a useless box, but came across a moody useless box that looks more interesting, but don’t have a Arduino to program it.
    It is a box made by Lanka.com http://www.lamja.com/?p=451 and there is a PDE file that it allowable to be downloaded.

    It would be much appreciated as programming is a bit beyond me at the moment. I am working my way through the playgrounds app on apple. Don’t know if it’s the best one, but it starting to make sense.

    I know cork.ie is from Ireland, but I can’t work out how to send him a PM. Maybe I haven’t posted enough yet!

    Thanks anyone
     
  2. philba

    Active Member

    Aug 17, 2017
    940
    282
    A .PDE is an arduino file and you can do it yourself with a PC and an Arduino. You'd need to installed the arduino IDE.

    That moody useless box uses a custom 328 board but it is essentially an Arduino. You can directly substitute one for the custom board. You can find an Arduino Nano for fairly cheap (I bought 5 of them for $15 USD on ebay).
     
    Last edited: Feb 14, 2018 at 12:36 PM
    xox likes this.
  3. Jonlate

    Thread Starter New Member

    Dec 21, 2017
    16
    0
    Great.
    So I havent researched anything about the Arduino side of it yet, but Arduino nano has a space to connect the chip to program it for the box?
    I can then remove that and make up my own circuit?
    Maybe I should do research this before asking stupid questions!!
     
  4. philba

    Active Member

    Aug 17, 2017
    940
    282
    Yes. It uses USB to program the chip and has the connector right on the board. You'll need a Mini USB, not a Micro, cable.

    A quick look at that circuit shows a button switch and 2 servo motors - they can be easily hooked up to the Nano. If you pick the right pins, the sketch (the .pde file) will just work. Note that file is old style Arduino so you might need to do a cut and paste to get it going but that's easy.

    edit: not sure why they are using a MOSFET Those servos are pretty self contained.
     
    Last edited: Feb 14, 2018 at 2:29 PM
  5. philba

    Active Member

    Aug 17, 2017
    940
    282
    A little more on this. I looked at the schematic. To use an arduino directly, you will just need the switch, servos, diode and the MOSFET, get rid of everything else. I'm not sure the MOSFET is actually required though it might help the batteries last longer depending on the continuous draw of the servos when they aren't moving. The schematic shows the arduino pin connections. Also, don't connected the USB port with batteries installed. Do the programming, disconnect USB and then install the batteries to test. You could insert a switch to cut out the battery to make it easier.
     
  6. be80be

    AAC Fanatic!

    Jul 5, 2008
    1,276
    231
    Watch what Arduino Nano you get some are 3.3 volt not 5 volt

    MOSFET is because there putting the arduino to sleep.
     
  7. Jonlate

    Thread Starter New Member

    Dec 21, 2017
    16
    0
    Thanks both.
    So I need to get the Arduino 5 volt version?
    What would happen if you did connect it with the batteries installed? Would you just burn out the Arduino?
    Do you think it will be okay to wire it all together without putting it onto a board, or would it be best practice to do it properly? Maybe I don’t need to ask that, it’s always better to do it right the first time around.

    Looking at Arduino, do I need to get the uno not the nano? The nano seems to have a square chip soldered to it, whereas the uno seems to have the long chip I need.

    Now I am starting to get my head around it, let’s get on with ordering the Arduino and servo.
    Then it’s a visit to the charity shops for a box!!

    Thanks again so far for your help.
     
    Last edited: Feb 15, 2018 at 12:32 PM
  8. Jonlate

    Thread Starter New Member

    Dec 21, 2017
    16
    0
    Quick question,
    The Arduino nano seems to have a square chip on it that soldered on.
    The Arduino uno seems to have the chip that’s used on the above box.

    Is it the uno one I need to buy?
     
  9. LesJones

    Well-Known Member

    Jan 8, 2017
    1,107
    250
    Yes you need an Uno. But also there are some versions of the Uno with a soldered in surface mount 328P so you need to make sure the one you order has a plug in 928P.

    Les.
     
  10. philba

    Active Member

    Aug 17, 2017
    940
    282
    You can use an uno but it's a) more expensive, b) a lot bigger. Uno and Nano are equivalent - you can use either. A nano fits in a solderless breadboard if you solder on header pins. Definitely the way to go in my mind.

    Yeah, you want a 5V Nano but I've never seen a 3.3V one. It can be confusing because it has a 3.3V regulator even though they run at 5V. A quick check of the ads on ebay shows nothing but 5V called out. Also, there are a LOT of similar looking small Arduinos and some of those do run at 3.3V - Pro Micro, Pro Mini, red stick, ... Some have USB, some don't, some run at 3.3V, some at 5V. If you stick to an Aruino Nano clone, you will be fine. But do check to make sure.

    On the voltage. The Nano (and uno) have a 5V regulator and are spec'd to take a 12-7V input but you won't use that. For the 6V battery, the circuit you linked to uses a diode between the battery and the 5V input. That drops the initial voltage to around 5.3V which the Nano (and uno) will run on OK. The diode also helps prevent the servos from causing problems with the Nano if they momentarily pull the battery voltage down (the caps on the nano/uno will provide some power during the sag).
     
  11. philba

    Active Member

    Aug 17, 2017
    940
    282
    As you've probably figured out, there are a lot of conflicting opinions. Often there is no one right way to go. What I'm trying to do is give you a simple path to follow.
     
  12. philba

    Active Member

    Aug 17, 2017
    940
    282
    And by the way, there are two versions of the Uno R3 (and clones) out there - one with the ATMega 328 in a DIP package and one with the same 328 version in the square surface mount package. Inside they have the exact same chips. The one with the DIP package is more expensive than the one with the surface mount package. The surface mount package is the same one used on the Nano.
     
  13. philba

    Active Member

    Aug 17, 2017
    940
    282
    Here's the breadboard of the circuit to use a nano. The mosfet is different from the original schematic but they have the same pinout so the IRLZ14 works the same.
    useless box_bb.png
     
  14. MrSoftware

    Active Member

    Oct 29, 2013
    821
    221
    If you're clumsy and pop the chip somehow, and don't have a hot air rework station, then it's easier to replace the chip on the DIP version as it just plugs in to the carrier. ;)
     
  15. philba

    Active Member

    Aug 17, 2017
    940
    282
    If you decide to go the route of building the PCB in the linked project, you can get an Uno with the dip (ATMega328PU), program it, pop the chip out and plug it into the PCB you made. If you want to use the uno for something else, you will have to get another chip and get the Arduino bootloader programmed. Certainly one way to go.
     
    Reloadron likes this.
  16. Reloadron

    Distinguished Member

    Jan 15, 2015
    2,700
    1,200
  17. be80be

    AAC Fanatic!

    Jul 5, 2008
    1,276
    231
    Here a 3.3 volt nano so they do make them
    Edit I thought it was a ver like 3.0 I have 4 that are 3.3 volt Now What funny is I was making one of these boxes figured I just order One of those nano just cause I wanted to lol
    I open it up look at it and see dang it's 3.3 volt not that it wouldn't work it will
    The nano and uno are same chip some uno come with removable chip but for this a nano would be easy way to go most work done done. But the 5 volt would be easier.
    Or just get a cheap knock off uno

    Screenshot from 2018-02-15 18-37-10.png
    Well I didn't think the Nano came 3.3 volt myseft I I just open the second one and it has a 5 volt regulator like should be on the first one LOL so maybe is was just a mistake.
    and the put the wrong part on it.
     
    Last edited: Feb 15, 2018 at 7:07 PM
  18. Jonlate

    Thread Starter New Member

    Dec 21, 2017
    16
    0
    Thanks for all your comments so far!!

    Is there a big difference between a real Arduino and a fake/ clone one?
    Will the Arduino program know the difference and not like a cloned boars
    Also many of the clones seem to have different pin layout, they say things like this.....

    ‘Stitching changes: beside the AREF sutural are two extra I2C pins (SDA and SCL which are copy of Analog 4 and 5, not additional I2C interface). Beside the RESET also are two extra pins, one is IOREF which supports the extension board stand load voltage. The stitching just shows extension board the current on-board voltage. The other one is backup placeholder pins. The RESET circuit is more stable. RESET button position is changed, and moved to near the USB interface of voids, which is more convenient. ATmega16U2 replaced 8U2, but it does not mean that the 16k flash of R3 can make your code run faster. This upgrade works to the USB interface chip, which enables UNO simulate USB HID in theory, such as MIDI/Joystick/Keyboard.’

    Does a real Arduino not have or have these things?

    I am starting to get really confused about what’s the best thing to buy?
    Nano, uno, real, fake etc etc.
    I am starting to get moody, let alone make a moody box!!
     
  19. Reloadron

    Distinguished Member

    Jan 15, 2015
    2,700
    1,200
    There are likely a dozen "clones" or "counterfeits" of Arduino out there. Some are good and work fine while others not so much. There are a few reasonably good reads on the subject so rather than a 500 word essay as a post I would just suggest you read this article and then follow up and read this article. The latter article is a follow up to the first.

    Now for obviously the people at Arduino are not very fond of the people selling knock off versions of their hardware and they cover how to identify the real deal from the knock off, that information can be found here. Personally I do not own a clove version but if I am not mistaking we have several forum members who have used the clones and knock off versions. I have read comments saying they were the same as and just as good as while others looked much less favorably on them so really I don't know what or who to believe. The mixed reviews are understandable since there is no one single manufacturer making the things so logically I can see where some would be better than others.

    The end result is you, based on some homework and reading, decide which you want to buy. Should you choose a "Genuino" (Italian for Genuine) I suggest you buy from a reputable distributor.

    Ron
     
  20. philba

    Active Member

    Aug 17, 2017
    940
    282
    To be frank, the lady doth protest too much.

    I've never used a "real" Arduino but have around 15 various Arduino clones (Arduini cloni?) and all of them work perfectly fine. I have Unos, Megas, Pros, Pro minis, and lots of Nanos from about 6 different manufacturers. They all work fine. The differences the Arduino people point are actually the differences between the "R3" Arduinos and prior versions. Really only a concern for specific shields. Most clones are also of the R3 version. Plus, it is open source hardware so the concept of "genuine" is kind of vague. Basically, the ATMega Arduino is a glorified breakout board for the ATMega chips - 99% of the value is in the development tools, sample/demo code, libraries and community.
     
    MrSoftware and Reloadron like this.
Loading...