Mechanical jewelry box schematic - Page 1
Forum section: electronics / projects

author: Youkai
author_rank: Regular Contributor
timestamp: February 03, 2020, 05:07:35 am
content: I'm working on a mechanical jewelry box and I'm very new to electronics. This will be version 2 of my project. The first one was only semi successful so I'm giving it another go. I had a thread for the version 1 project that I'll link at the bottom if you are interested. For now though I have made some minor modifications to the schematic from that (adding BAT54S instead of wiring that part myself) and I'd like to run the schematic by you guys to make sure I haven't messed anything up horribly.Here is some info on the parts I'll be using. I'll leave out the common things like capacitors and resistors that are standard their source shouldn't affect the circuit.Wall Adapter (x1):https://www.jameco.com/z/GS18U09-P1J-MEAN-WELL-2-Wire-AC-to-DC-Regulated-Switching-Wall-Adapter-18W-9VDC-2A-2-1mm-Plug_1952847.htmlBarrel Plug receiver (x1):https://www.jameco.com/z/WTJ-020-37A-2-1mm-Male-DC-Power-Jack-Breadboard-PCB-Mount-_2210677.html?CID=MERCHPro Micro:https://www.sparkfun.com/products/12640NeoPixel (x6):https://www.adafruit.com/product/2869Button (x1):https://www.adafruit.com/product/482(or similar)MG90S Servo 9G Micro Servo (x3):https://engineering.tamu.edu/media/4247823/ds-servo-mg90s.pdfMy schematic is attached. Please review and let me know if you have any comments. While I was working on the schematic I was thinking about the two 0.1uf capacitors near the NeoPixels. Those two are functionally "in the same place" in that they both connect the 5v source to ground. Do I need both of them? The way the schematic is drawn ether of those capacitors is protecting against power dips for both NeoPxel and the LED Button (i.e. everything running off the 5v rail); correct? Any reason to have 2 of them? If I needed that much capacitance couldn't I just use a single bigger one?Original thread:https://www.eevblog.com/forum/projects/borderlands-style-jewelry-box-research-thread/

author: Youkai
author_rank: Regular Contributor
timestamp: February 05, 2020, 03:45:13 am
content: Anybody? If you could just verify that the circuit won't blow up and answer the question about the capacitors I would greatly appreciate it. Thank you!

author: InductorbackEMF
author_rank: Regular Contributor
timestamp: February 06, 2020, 12:13:57 am
content: Hi,the 100nf capacitor would be for noise/emi suppression and would be best being a smaller capacitance due to less ESR/ESL.As such placing the capacitors as close to the Pixels/power supply rail would be best.Alex.

author: InductorbackEMF
author_rank: Regular Contributor
timestamp: February 06, 2020, 12:16:13 am
content: Also i would say yes having both would help, keep in mind placing them fairly close to the supply for the pixels if you can.Alex.

author: Prehistoricman
author_rank: Regular Contributor
timestamp: February 06, 2020, 12:32:49 am
content: Are you sure the 'LED Button' is right? What's the purpose of this pin 16 connection?

author: InductorbackEMF
author_rank: Regular Contributor
timestamp: February 06, 2020, 12:33:07 am
content: Oh i checked the circuit again and saw that the data out pins? of the microcontroller would be pulled down to (about) 500mv due to the Schottkey diodes not sure if the neopixels data inputs work down that low?Alex.

author: Ian.M
author_rank: Super Contributor
timestamp: February 06, 2020, 02:06:09 am
content: Swap the pin 1 and pin 3 connections on both BAT54S double (series) diodes so the center (3) goes to Data and the anode (1) goes to ground.Their purpose is to clamp Neopixel Data in to prevent it going outside the supply rails (e.g. due to transients or when the Arduino is powered via USB but main 9V power in is disconnected) to protect the Neopixels .As noted in the previous thread, if the cables to the Neopixel strips are long, the BAT54S diodes and the 0.1uF decoupling caps should be soldered directly to the Neopixel strips.

author: Youkai
author_rank: Regular Contributor
timestamp: February 06, 2020, 02:40:55 am
content: Quote from: Prehistoricman on February 06, 2020, 12:32:49 amThis allows me to blink the LED by manipulating pin 16.Quote from: Ian.M on February 06, 2020, 02:06:09 amDefine long. The wires to the farther away neopixel will be about 6 inches long. I was hoping to mount those to the stripboard so they could hide in the base of the box. There isn't any space where they are mounted to have them. The capacitors are pretty small; I can probably make space where they are being mounted for the capacitor. Could I move them to the other side of the BAT54S and mount it directly to the +/- of the neopixel? Then I could put the BAT54S on the main board.Ill fix the BAT54S wiring as you noted.

author: DaJMasta
author_rank: Super Contributor
timestamp: February 06, 2020, 02:49:10 am
content: There are a lot of extraneous components that won't have positive effects if there are any, I think.The BAT54S diode pairs in the current configuration cap the maximum data high value at a single diode drop... which is probably not as intended. I don't really know why they'd be prone to transients or that the data pin is especially sensitive to them - I'd just remove them entirely. The Pro Micro has a regulator onboard that drives the micro, and the micro drives the data pins, so they will never be driven with 9V unless you've got some dramatic fault condition on the pro micro that cooks it as well. I also don't know why there's separated 5V rails.... and if there's only a diode between the main one and the "reservoir rail"... that one will never be at 5V, it will be at 5V minus the diode drop in between.The 470 ohm series resistors to the neopixels seems... excessive? If anything, I'd expect a pullup for serial data lines, but in this configuration, I guess you can protect the micro from dead shorts in the neopixels? Or if you have excessively inductive lines between, you can reduce the edgerate of the pulses to be absolutely sure it doesn't overload (which is not likely to be useful outside of really extreme situations). Same case with the 470 ohm series resistors to the PWM drives of the servos, maybe you want something for bonus protection, but 470 probably isn't necessary and it's usually fine to drive them directly from the micro's pins.You can also probably sense the LED switch with a single pin on your pro micro - not exactly sure why there's two. The resistor divider to pin one serves no purpose unless you're looking for a coarse software check of the power source - if you actually want to monitor the 9V rail, you should just put that divider into an analog input pin and sample it.That much capacitance on the 5V rail probably isn't necessary, but isn't harmful. Having the second 1000uF cap near the servos (with the first near the converter) is probably the best configuration using two. Decoupling the neopixels is fine, but likely isn't required - could be worth a test.

author: Youkai
author_rank: Regular Contributor
timestamp: February 06, 2020, 03:01:06 am
content: DaJMasta I'm very new to electronics so most of this circuit was designed through the gracious help of people on this forum in the other thread; primarily Ian.M. This circuit is for a hobby project so I don't need it to be 100% bulletproof. If it's over-engineered then I'd certainly be willing to remove redundant/unnecessary components for the sake of saving space.I'll answer the couple items in your post that I know the answer to. Hopefully Ian.M can comment on the rest.The reason for the reservoir rail is so that when the servos start their rotation and draw a lot of power they don't cause bad things to happen to the neopixels. I'm told that when the servos are actively rotating, especially under load they draw a fair amount of power so that could be mean to the neopixels.One of the button pins is to detect the state of the button. The other pin is to let me control the LED embedded in the button. I'm going to make it blink or something when pressed. Or maybe flash when it's not pressed. Something like that.

author: Ian.M
author_rank: Super Contributor
timestamp: February 06, 2020, 03:30:30 am
content: The 470R resistors between the MCU and the Neopixel strings are recommended by Adafruit to prevent damage to the data input of the first LED by limiting the current during transients that may take the input outside the rails.The 470R resistors between the MCU and the Servos may be needed to limit the input current in the case when the Arduino is being powered via USB during programming, but the servo 5V supply is down because no external power is connected. Many models of servo are likely to have inputs protected against signals being applied without power, and if you are *CERTAIN* your specific servos are protected, the 470R resistors could be omitted.Does the button's internal LED have a built-in series resistor? if not, you need one!

author: DaJMasta
author_rank: Super Contributor
timestamp: February 06, 2020, 03:49:03 am
content: The switch makes sense, then, you'd need some fancy programming to use only one in that case.The servos definitely are the current hogs here, that's why if you're going to have extra decoupling caps, it's good to have them near there. The neopixels are designed to be placed individually in long strings, so while I don't know if they have internal decoupling, they are probably designed to be able to operate in noisy environments.There will definitely be noise on the power rail because of the servos, but I doubt it will be problematic with 2000uF of decoupling and the on-board decoupling for the micro so long as the switchmode converter can actually deliver it. I wouldn't be surprised if removing the 0.1uF caps, the 470 ohm resistors, the BAT54S diodes, and the zener (?) diode from the schematic entirely would work the same as as proposed in the vast majority of situations.As a matter of flexibility, I'd move the 10k resistor divider from pin 1 to pin 21, so you can use it as an analog input to monitor the 9V in addition to just a digital reading... and if you don't need to monitor it or check it, just removing them too is an option - not exactly sure what requirement it fills.Regardless of what schematic you settle on, it could be worth trying some elements of the other to see how they actually effect things - the parts required are pretty cheap, so it's basically only the time investment in the rework (which is almost nothing if you use a solderless breadboard to test it first!)For the post that's appeared before I could post this reply:Fair enough with the 470s, then, I hadn't heard of such requirements for neopixels and have never implemented series resistors on the PWM control pins for interfacing with a micro, myself, but if there are instances where it's useful, they're certainly not a big ask, and I doubt either will have any negative effects.

author: Ian.M
author_rank: Super Contributor
timestamp: February 06, 2020, 03:57:06 am
content: The 9V monitoring circuit was to allow the Arduino code to wait for external power to be good, rather than driving the outputs controlling the servos and Neopixel strips if they aren't powered. The 470R resistors were for extra insurance if there was a bug in that part of the code during development, but I wan't too happy about possibly driving ~10mA into an unpowered servo or neopixel input long-term, hence the 9V monitoring circuit.There'd be more space to be saved by using a bare ATmega328P (@8MHz Int. Osc.) instead of the Arduino Pro Micro, so IMHOMuntzingthe passives isn't worthwhile.

author: Youkai
author_rank: Regular Contributor
timestamp: February 06, 2020, 04:29:02 am
content: OK so here is the updated schematic. I fixed the BAT54S, and added a resistor to the button LED. I also took out a bunch of the empty space. Is that OK or does it make it "too busy" and hard to read?I understand the comment about Muntzing it. I'll just have to find a way to make it fit.

author: Youkai
author_rank: Regular Contributor
timestamp: March 07, 2020, 09:35:54 am
content: Ian.M how important is that 9v detection? It seems that it's either not possible or I'm massively misunderstanding how it works.I used a solder-less breadboard to work on my test circuit. I set up a circuit that has my 9v source going to a positive and negative rail in the board. Then I put the positive to my "raw" input on the ProMicro and the negative to the GND next to RAW. Then I used two 10k resistors. One each for positive and negative rails on the board. Both I had bridging their rail to the same row in the board. Using a third slot on that row I put a wire to pin 1 on the ProMicro.I believe that setup wires the top right of my schematic. I.e. the 9v rail, the pro micro, and the pin 1 connection. But when I leave the wall wart unplugged and power the ProMicro from USB it still registers a positive digitalRead at pin 1. Using a meter across the positive and negative rails shows 5v in this scenario. I believe this means that the "RAW" pin is supplying 5v to the rail. This means that any time the ProMicro is plugged in (either through the wall wart or USB) I'm going to show a positive digitalRead at pin 1. I think this means that the whole pin 1 part is superfluous since it won't tell me what it was designed to tell me. I believe in the scenario I just wired you want it to show a digitalRead of "0" since the wall wart isn't plugged in.Do I just take out the pin 1 stuff then? Am I totally misunderstanding how to use it?

author: Ian.M
author_rank: Super Contributor
timestamp: March 07, 2020, 11:27:40 am
content: Its important - your PC's USB port cant supply enough current to run strings of Neopixels and servos, so your sketch needs to know not to try to do that when external power is missing. You could try detecting it with an analog pin, which should offer a clear distinction between about 921 analogRead() counts with power on, and 512 counts with power off, (assuming RAW continues to back-feed the 9V rail with 5V), but if it *IS* back-feeding via RAW, I'd recommend killing the back-feeding at source by adding a diode in series with the RAW pin, cathode to RAW. which should fix the pin 1 digitalRead() problem. Any 100mA or greater diode should do while breadboarding, and when you build up trhe final circuit, one half of a BAT54S should do nicely.However it may well be back-feeding via the 5V buck converter, from a servo with its signal pin held high by the I/O pin driving it. Make sure those I/O pins are low or hi-Z all the time from powerup till when you test the voltage (or digital level) at the 2x 10K divider.N.B. it could take quite a few seconds for pin 1 to go low after disconnecting 9V, if the servos and Neopixels aren't running, as you've got a lot of bulk capacitance associated with the buck converter.

author: Youkai
author_rank: Regular Contributor
timestamp: March 07, 2020, 04:30:17 pm
content: It was definitely the RAW pin feeding the voltage. When I was debugging why it wasn't working I de-connected everything else. My whole circuit was just the ProMicro and the voltage divider. Adding a Diode fixed it. So I'll go with that.Thank you.