logo elektroda
logo elektroda
X
logo elektroda

Arduino Nano: Connecting Power via Mini USB or VIN & GND with a 12V Supply - Aquarium Lamp

pdzran 9660 15
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17923588
    pdzran
    Level 13  
    Hello all

    I have an Arduino Nano that controls a lamp over an aquarium and I have a question about powering the Arduino itself.
    Nano has a mini USB input and a VIN pin from the description on the net.
    How to power them? Power supplies with mini USB output are usually 5V and this is according to description is not enough, it should be 6.5-12V.
    I bought a 12V power supply but it has a round output.

    Now the question is whether I should convert the plug in the 12V power supply and power it via mini USB or cut the tip and connect to VIN and GND on the board?
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • #2 17923605
    kaczakat
    Level 34  
    You don't have any plug on Nano, you can sacrifice a 12V power supply, after disconnecting from the socket a quick snip and enter the voltage on Vin here. 5V power supply you do the same, only you connect to USB or after cutting the plug to the 5V pin. Of course, GND to the set for GND pins. You connect only 5V to USB and of course a 500mA phone charger is enough for NANO (you can't supply more than about 200mA through the pins anyway). And if you're powering something else from it, you'll need to take that into account.
    Helpful post? Buy me a coffee.
  • #3 17923614
    snow
    Level 31  
    Arduino has a VIN pin and there you can enter the voltage, e.g. 9V
  • ADVERTISEMENT
  • #4 17923623
    pdzran
    Level 13  
    Currently I have a better 5V power supply, will 12V under VIN give me anything compared to 5V over USB?
    I am asking because I have a DIY aquarium lamp connected, 4 channels of 3W diodes and one 1W UV channel, theoretically they have 80x3W + 8x1W in total, I give 255 PWM on each channel and the wattmeter shows only about 90-100W, the lamp is bright, even the neighbor was wondering what I have at home, the power supply for the lamp is 240W.

    Is it the fault of the 5V power supply and the PWM signal is too low despite setting the value to 255 or something else?
  • #5 17923629
    snow
    Level 31  
    Giving 12V to VIN won't result in a 12V PWM output - it will still be 5V. Devices that draw large currents are best controlled by a transistor.
  • #6 17923658
    pdzran
    Level 13  
    In other words, powering Arduino 5V via USB can cause lower voltage on PWM and thus weaker LEDs?
    If replacing the 5V USB power supply with 12V VIN won't do anything, I won't mess with it.

    I didn't think about it before but I will measure the voltage on PWM.
  • ADVERTISEMENT
  • #8 17923685
    kaczakat
    Level 34  
    Whether you power the Arduino with 5V on USB or 12V on Vin does not matter for PWM, on the processor you have 5V on the power supply and 5V on the outputs anyway. It's better to give 5V, because 12V is only partly converted into heat to have 5V on the board, the more losses the more receivers and power consumption from 5V. If you have a wrongly selected transistor (if you use it), only this can have an effect, but if you have a mosfet opening at 10V, powering the Arduino with 12V will not do anything. At most, you will have such a voltage available in the area, you control the NPN transistor by giving it 12V and it will work properly. However, there are logic level mosfets (usually L in the name) that open fully already at 2V and you should aim for them.
    Helpful post? Buy me a coffee.
  • #9 17923689
    pdzran
    Level 13  
    I noticed this relationship:
    - the lamp connected to the turned off Arduino does not light up - normal, because PWM has 0;
    - the lamp connected to the turned on Arduino, either through a 5V power supply or to a laptop, shines brightly at PWM 255;
    - the lamp is connected without Arduino (the Arduino PWM pins are physically disconnected the board with the drivers, the PWM pins and of course the ground), the lamp shines much stronger;

    I am not an electronics engineer, so the question is how to connect transistors and what kind?
  • ADVERTISEMENT
  • #10 17923701
    kaczakat
    Level 34  
    But it doesn't have to be PWM, if you want to give a 100% signal for comparison, you can just put one digitalWrite() on the pin and you have a certain 100% filling, then when it shines, measure it with a meter, wattmeter, energy consumption will be proportional, senses they can be unreliable.
    Helpful post? Buy me a coffee.
  • #11 17923719
    pdzran
    Level 13  
    Dusk and dawn and they work fine, quite smoothly, one blue channel remains for the night and PWM 1 or 2 on it, my consumption is low, I don't remember how much but something about 2-4W, when I do dawn, i.e. PWM 255, it is bright and power suits me, but the wattmeter shows the mentioned 90-100W.
  • #12 17923725
    snow
    Level 31  
    The PWM signal is best viewed on an oscilloscope. If the lamp shines brighter without PWM control than when PWM is set to 100%, it means that there is something wrong with the current efficiency of supplying this lamp with PWM power.
  • #13 17923744
    pdzran
    Level 13  
    I'll measure something more today and post it here, I don't have an oscilloscope.
  • #14 17924123
    snow
    Level 31  
    The only thing you can measure is whether PWM 100% you have 5V on the output.
  • #15 17924132
    pdzran
    Level 13  
    That's what I want to do, because I suspect that the power supply may be to blame and if it does not give 5V, it may be less at PWM.
    I will measure today and possibly replace the power supply with 12V under VIN.

    Added after 2 [hours] 25 [minutes]:

    I measured and it turned out that the voltage at PWM 255 is 4.77 V and now it's a strange thing, I changed the power supply to 12V and on the same pin it is now 4.98 V, so it's good, the lamp looks brighter and the wattmeter still shows the same, i.e. 98 W.
    Is there any explanation for this?
  • #16 17935191
    snow
    Level 31  
    Any layout diagram? Maybe it's not the fault of the PWM but the system.

Topic summary

The discussion revolves around powering an Arduino Nano for controlling an aquarium lamp. The user inquires about the appropriate method to supply power, noting that the Nano has a mini USB input and a VIN pin, with a preference for a 12V supply. Responses clarify that the Arduino can be powered via the VIN pin with 6.5-12V, while the mini USB typically provides 5V. It is suggested that using a 12V supply connected to VIN is preferable for higher current applications, but the PWM output remains at 5V regardless of the input voltage. The user experiences issues with LED brightness and suspects the power supply's voltage may be affecting PWM performance. Measurements indicate that switching to a 12V supply improved the PWM output voltage slightly, leading to brighter lamp performance, although the wattmeter readings remained consistent. The discussion emphasizes the importance of using transistors for controlling high-current devices and suggests measuring PWM output for troubleshooting.
Summary generated by the language model.
ADVERTISEMENT