Finding Pin on MCU - microcontroller

I am fairly new to programming MCU. I have an ATtiny2313 and the datasheet came with a layout of how the pins are configured; however, finding pin 1, since the mcu is a square, is tough for me. I share the images of the diagram and the actual unit. Maybe I am overthinking the issue? Further reading materials are also greatly appreciated.
This is the datasheets diagram
This is the actual unit

Check the Packaging information section at the end of datasheet. There are physical properties of packages described including any marking to identify pin 1.
In some situations (some really small ICs) it can be hard to identify right pin 1 marking. In production, one simply rely on orientation of chip in the tape, but for populating boards by hand, little trick can come handy anytime you are not sure, you have identified pin 1 correctly.
In virtually any IC, there are ESD protection diodes from GND to any IO pin and prom IO pin to power rail. So, if you put a multimeter in diode measuring mode, you should see a drop about 700 mV (actual value can vary) when the positive probe is touching a ground pin and the negative probe any data pin, or when the negative probe is touching a positive voltage rail pin and the positive probe any IO pin. It is not 100 % fail-proof way, but really good and useful hint.

Related

Is it possible to connect many (20+) SPI sensors to an Arduino Mega?

I am making a system for measuring whether or not there is vacuum present in big steel containers. They are located up to 100 meters from the control cabinet.
The question is, how many SPI sensors can I successfully use at the same time with an Arduino Mega?
I have two main concerns, and there are probably more things I didn't think about.
Signal strength
The shared lines for CLK, MOSI and MISO will need to be split up at several junction boxes and led to the different sensors. Since the voltage out from the Arduino is fixed, I'm fearing instability because the signal is weaker for some sensors, has someone done something similar? What is the greatest acceptable voltage loss for these lines to an ordinary sensor?
Processing
Will the SPI library be fine coping with this many sensors?
The refresh rate can be set to extremely low, thinking 0.3Hz.
The alternative to all this is to go for 4-20mA sensors and have a 0-5V converter circuit for each sensor, near the controller.
Any inputs would be greatly appreciated!

Using an Arduino as EMG sensor

When I search online for EMG sensors, I often see these sensors are just made of a few transistors, resistors and sometimes diodes. Also I once read on a site that EMG sensors are some kind of modified voltmeters. But while I managed to make a voltmeter from an Arduino, I haven't been able to make an EMG sensor from an Arduino.
Does someone know whether it is possible to make an EMG sensor from an Arduino and how they did achieve this?
I think the biggest problem here is that of dynamic range. EMG signals are AC voltages typically in the low mV range and would need a gain of 100 or so to get them up to +/-2.5V, then a simple offset circuit to convert that to 0-5V for the Arduino analog inputs. However, that's not the whole story, since the small EMG signals can ride up and down on large low-frequency background voltages. Your AC amplifier would need a high-pass filter to remove those, or they could drive it off-scale which would prevent the EMG from getting through. If you reduce the gain to keep things in range, the EMG will be a rather small part of the 10-bit ADC range on the Arduino.
So the thing to ask is what is the point of using the Arduino in the first place? If you are going to connect it to a computer in order to look at the EMG signals, then why not just skip the Arduino and use the computer's sound card? The Mic input probably has enough gain already, and you get at least 16-bit resolution to handle any large non-EMG background that wasn't filtered out.
IMPORTANT! EMG measurements require direct electrical connection to the body. For safety, you should make certain that your recording equipment is electrically isolated. If you use only a standalone Arduino, you should power it from batteries. If you use a computer, it should be a laptop running on batteries, with no other connections to ground.
I often see these sensors are just made of a few transistors,
resistors and sometimes diodes.
That's true for pretty much all electronics devices...
Does someone know whether it is possible to make an EMG sensor from an
Arduino and how they did achieve this?
You cannot build an EMG sensor from an Arduino. But you read sensor values with an Arduino either through serial interfaces or by measuring voltages.
With a bare Arduino you can neither measure negative voltages nor can you amplify small signals. (we're in the µV range here...)
Just buy something ready or learn more on electronics

GND Servo and Arduino

I was working in a little project with Arduino and two Servomotors
Why is it necessary to putting the GND from external source (necessary to power the servomotor) and Arduino GND together?
Why is not able to work properly with separated GND?
Whenever you interface your Arduino to a separate device -- or several -- you must establish a common ground. Perhaps your servos run off their own power of a small breadboard, or you have a sensor or a bunch of LEDs... in all cases you'll need to make a common ground for all components of the circuit.
If I'm hooking up more than a single LED or single sensor to my Arduino, I prototype on a breadboard and the first thing I do is connect the power GND pin of the Arduino to the blue/black ground rail of the breadboard. That ensures a common ground, which is vitally important as a reference 0V in any circuit you build.
In many well-designed multi-layer circuit boards for example, often one layer of copper is devoted entirely to GND so that every component will be able to have a solid connection to GND. Then it's referred to as a "ground plane" and is a common goal in good circuit board design.
Current flows from + to - in a circuit, from the highest to the lowest reference point. See details here and here.
The GND is a reference point usually 0v.
With different GND (I'm guessing different positive input as well), you might end up with:
some short circuits
independent circuits
reflection phase change if you are working with alternating currents
Anyway in a circuit the GND should always the same (even though it can be in multiple places).

5 volt output max current for Arduino Mega 2560 rev3

Well I've looked and looked and just cant find data on the max current of the 5 v output (or even a suggested reasonable max)
They all mention 50 mA for the 3.3v output.
Looking at the chip it's a smaller board than the Arduino Uno so I don't want to pop it.
I assume someone will know the max current that the regulator on this board can handle and surmise what the 5v current out could be? Thanks in advance!
EDIT: The regulator / board 5v pin out, not chip related.
EDIT: Assuming supply is from the 12v power adapter.
The schematic shows a NCP1117ST50T3G. The datasheet shows 1500mA (typical).
Note that you may not actually be able to draw that at the higher end of the input voltage range since the Arduino may not provide sufficient heatsinking, needed since the regulator will shut down if it gets too hot (and the regulator will melt down if it doesn't shut down).
Also note that the traces on the board may not be designed to allow that much current to flow safely, and you could end up damaging the board itself regardless.
I'm going on record that you can put any amperage as input as long as the voltage in within range. So, if you have a 5V 200A high power input you are still fine. Now, If you have a short, you're cooked. But a properly designed circuit will draw what it needs and nothing more.
Hyperbole. I know absolutely nothing about this topic. I'm hoping a lot of people will call me names and one of those will correct me with a correct electrical engineering based answer. Either my view is correct or it isn't.

Arduino and External Peripherals

I am a CS guy getting started with Arduino. This is probably a very basic electronics question but from going over the arduino tutorials everything is connected to the arduino with a resistor.
Well since i am following the tutorials i know what type of resistor i should use but what i do not know is why i should use one? and What type of resistor to pick i am to do something which is not covered in a tutorial.
The resistor simply serves to limit the current into or out of a pin in case something goes awry. If your AVR decides to output high on a pin that something else wants low (or vice-versa), large, damaging currents can occur if not limited by some resistance. The current limit for AVRs is about 20 milliamps, and given that the voltages are usually 5V, something larger than 250 ohms "would work".
To give a margin of safety, 1-10k is a great choice; for digital signals it seldom matters unless you're into very high-speed applications (beyond the AVRs capability anyways). For analog inputs, a similar resistor would also be advisable, as the amount of current the ADC takes to sample is negligible when your resistor is in the few kilo-ohm range.
The underlying principle that you want to learn is Ohm's Law, which describes the relationship between voltage, resistance, and current in a circuit.
Resistors are used to
limit current,
devide voltage
protect against over voltage
pull-up, pull down
current to voltage conversion
etc ...
1) limit output current, the absolute max current per IO is 40mA, a typical LED works on ±2V 20mA.
the resistance value can by calculated by (5V - 2V)/(0.02A)=150Ω usually a 220Ω resistor is used, because: it consumes less power, there doesn't flow 20 milliamps, and there is no notable difference in emitted light.
2) if you have a analog voltage that variates between 0 and 10 Volts, you 'll need a voltage divider of 1/2. pick by example z2 10k and calculate z1 by 10k*(Vin,max/5V -1). take a value of resistance higher than the original calculated. and recalculate the new Vout.
3) place a resistor of 10k in series between the analog input of the arduino and the 'to measure voltage'
3) if you have to measure a analog current, you place a resistor to ground and the analog input, calculate the resistor by Z=5V/amps.
4) if you connect a button to the arduino, you 'll need to place a pull up or a pull down resistor. if you 're not using a resistor, the input is floating and can take any value (high or low). or you can enable the internal weak pull up. by pinMode(xx,INPUT); digitalWrite(xx,HIGH);. and disabeling by digitalWrite(xx,LOW); by default the pull-up is disabled.

Resources