How many MAX7219 chips maximum can be cascaded? - arduino

I am trying to make a large moving sign that consists of Arduino (as the microcontroller), an 8x8 dot matrix (as the display) and MAX7219 (as the controller for the dot matrix display).
Is it possible to use 16 MAX7219 chips?
Thanks.

I don't know what arduino board are you using, and the answer may vary. Anyway:
If you have an Arduino UNO: you can't connect them directly, since the UNO has 14 digital I/Os, and you need at least N+2 pins to communicate with N MAX7219. Moreover I think you want to send commands to it, so the number of pins is drastically reduced. You can however use any port expander to have more I/Os and so communicating with it.
If you have an Arduino MEGA you will probably already have already all the I/Os you need.
In both cases probably the limiting factor will be the speed.. Just make some tests and you'll find it out

Related

is there a way to do plugnplay for arduino?

First Thanks in advance.
Is there a way for an Arduino board to detect what other boards are attached (such as infrared, or servo motor etc) or simple things such as led or push buttons? Basically is there a way to do Plug N Play?
I would like to design a system using an Arduino were the user can mix and match infrared sensors, motors, led. The script would recognize what is attached to the board and respond accordingly. Currently one is forced to hard code in the script identifying what pin is attached to what. Hence if the user pulls out a servo motor and adds an infrared, then the script must be rewritten. This is what I want to avoid.
Thanks.
You started with
user mix and match sensors, motors, led. The script would recognize
what is attached
and later added
Arduino for model railroads, to dynamically add servos, lights and
sensors
These are not the same, narrowing the scope makes all the difference. See my comment for first option. As for building a specific model that will recognize elements, sure, this can be done in couple of ways depending on the topology you intend to implement and in that case the main concern should be:
How will elements/nodes be connected to each other and / or the main board?
If you intend to run seperate wires for each element you could identify them by dedicating one wire for ID and use a different resistor on each, That's complicated and limited and I wouldn't do that.
On the other end you could create a parallel bus that runs from node to node and can be extended as needed, it will have a small number of wires that will implement I2C for instance, and for identification but also as local drivers you would add an ATtiny on each node.

How do I use device registers to configure the operation of a device?

So I'm building a device to measure pressure in a clean room and using a Raspberry Pi Pico with a pressure sensor. I'm writing the code in Micropython and while the sensor is designed to be used right out of the box, I'm interested in how I use the device registers to modify it's operation (as well as other peripherals I have attatched). I understand the registers are 8-bit and how how the hex translates to binary and back. However, the code for the lists all the editable registers and their hex addresses but I have no idea how to modify the bits to turn off/on the features represented by each bit.
Does flipping each bit on/off just change the binary and thus changes the device register hex?
Thank you!

Small PWM module?

I'm trying to find a fitting module/component for a project, but have a hard time finding the right thing.
I need a PWM module/component that can provide a PWM signal and can be controlled via Arduino, preferably TX/RX.
I've used this one previously, and it works great, but it is bulky due to the screen and buttons which I don't really need.
It would be perfect to find the same module but without the screen and buttons.
What it needs to do:
Duty cycle 0-100%
Frequency 1-10 kHz
5 V preferably
Communication via tx/rx or other Arduino compatible protocol
1-2 channels
As small as possible
I've seen some Adafruit modules, but they have at least 16 channels which is not necessary. Would also work, but if I can find an even smaller alternative that would be great.
Any suggestions?
(And no, the Arduino's PWM signals do not work in my case.)
The standard Arduino analogWrite() can't do what you want without trickery, but most Arduino hardware can, so there's no real need for a separate PWM IC or module; you just need to code the Arduino's MCU's timer peripheral to do what you want.
You can do that "by hand", but I would try first to see if an alternative library like TimerOne can get you the PWM you specify. For SAMD21-based Arduinos there is this library (that I wrote), among others.
If you insist on having a separate module for your PWM, just google around (modules exist, but recommendations are not done here), or simply use a second Arduino of your choice as a dedicated PWM generator.

Arduino drone project

I am working on a drone project and currently choosing a board to use. Is it possible to use an Arduino Nano for all needs which are:
Gyroscope and Accelerometer
Barometer (as an altimeter)
Digital magnetometer
WiFi (to send telemetry for processing)
GPS module
4 motors (of course)
P.S:
I know nothing about Arduino. However I have a good ASM, C/C++, programming background and I used to design analog circuits.
I would like to avoid using ready-made flight controllers.
Pin count should not be too much of an issue if using I²C sensors, they would simply all share the same two pins (SCL, SDA).
I agree that the RAM could be a limitation, the processing power (30 MIPS for an arduino uno) should be sufficient.
On an arduino mega, the APM project ran for years with great success.
I believe it's possible to do a very simplified drone flight controller with an Arduino nano and several I²C sensors + GPS.
But even with a more advanced microcontroller it's not a trivial task.
*** If you still want to try the experiment, have a look at openlrs project : https://code.google.com/p/openlrs/ . It's quite old (there are several derived projects too), but it runs on a hardware similar to arduino uno (atmega328). It provides RC control, and quad flight controller with i²c gyroscopes, accelerometers (based on wii remote), and barometer.
It also parse data from the GPS, but afaik it doesn't provide autonomous navigation but it should be possible to add it without too much additional work.
edit : about the available RAM.
I understand that at first sight 2kb of RAM seems a very small amount. And a part of it is already used by Arduino, for example the serial library provides two 64 bytes FIFO, using some RAM. Same for the Wire (I²C) library, although a smaller amount. It also uses some RAM for stack and temporary variables, even for simple tasks such as float operations. Let's say in total it will use 500 bytes.
But then what amount of RAM is really required ?
- It will have a few PIDs regulators, let's say that each one will use 10 float parameters to store PID parameters, current value etc. So it gives 40 bytes per regulator, and let's say we need 10 regulators. We should need less, but let's take that example. So that's 400 bytes.
-Then it will need to parse GPS messages. A GPS message is maximum 80 bytes. Let's allow a buffer of 80 bytes for GPS parsing, even if it would be possible to do most of the parsing "on-the-fly" without storing it in a buffer.
-Let's keep some room for the GPS and sensors data, 300 bytes which seems generous, as we don't need to store them in floats. But we can put in it the current GPS coordinates, altitude, number of satellites, pitch, roll etc
-Then some place for application data, such as home GPS coordinates, current mode, stick positions, servo values etc.
The rest is mostly calculations, going from the current GPS coordinates and target coordinates to a target altitude, heading etc. And then feed the PIDs to the calculated pitch and roll. But this doesn't require additional RAM.
So I would say it's possible to do a very simple flight controller using 1280 bytes. And if I was too low or forgot some aspects, there's still more than 700 bytes available.
Certainly not saying it's easy to do, every aspect will have to be optimized, but it doesn't look impossible.
It would be a trick to make all of that work on a Nano. I would suggest you look at http://ardupilot.com/ they have built a lot of cool thinks around the ARM chip (same as an Arduino) and there are some pretty active communities on there as well.
Even if you didn't run out of pins (and you probably would), by the time you wrote the code for the motors and the GPS, you will run out of RAM.
And that's not even getting into the CPU speed, which is nowhere near enough. As mentioned in the other answer, you'll be better off with a Cortex M-x CPU.
Arguably, you could use a few Nanos, one per task, but chaining them together would be a nice mess...

How to read multiple Analog sensor

I am using Arduino UNO board. I have 24 analog channel which gives me 0~5v analog out put. Now my problem is I have only 5 analog channel. I wanted to read value from each channel for every 2 min and then switch to other channel. Can anyone suggest me in Hardware how can get analog value ?
I am planning to use 8:1 multiplexer or 16:1 multiplexer . Will it is correct way of doing it. Can you suggest other way of doing it in hardware ?
74HC4051,74HCT4051,ADG708,MD14051B,
IC I am planning to Use.dep[end on so,s1,s2 just switch the channel
As a start, you might need to know that even Arduino Uno also have internal MUX. In my experience of reading multiple analog channel, this is the approach that I take. However by taking this approach, I suggest you to recheck the analog value so adding MUX will not generate any error or bias.
This could be done by comparing the output of measurement with the MUX and output of measurement without the MUX. I used 74HC4051 and it works brilliantly, just make sure not to leave any pin floating. The only disadvantage of this method is that you will need to use some I/O to control the MUX, but if that is not an issue for you, then go ahead.
Any other method could be more complicated. It would require your analog channels to correlate with each other, and you need to find a way method to combine multiple analog channel into a single channel.
e.g: if your aim is to compare two analog value, instead of measuring the value and comparing the value in software, you could make use of op-amp comparison circuit to compare the value for you and take the comparison result instead.
Use the photon-pixel coupling method, it is a new approach in science for sampling an unlimited number of sensors in parallel.
Basically, each sensor output is an LED. If you have 10000 sensors, the output of all of them is inserted in a LED array, a LED matrix as the authors say. After that, the LED array is filmed by a video camera and the images are processed in real time by a computer. A software reads one pixel from each LED from the LED array and converts it to numerical values. So, your LED array will be converted in a matrix (with 10000 elements) filled with numbers that can be processed as you wish in your software. I don't know if I was explicit but you can read their article here: https://www.sciencedirect.com/science/article/pii/S2215016119300901
Note that classic multiplexing is serial, this approach is parallel.
The photon-pixel coupling method is truly ingenious because it solves two main problems in engineering: an unlimited number of sensors and their parallel sampling at video rate frequencies. Just imagine, we can read as many sensors as we wish. What I wander is if we can adapt the photon-pixel coupling to Arduino. I am new in the world of microcontrollers but I know Arduino can support a cam, so it should be possible.
If you are a PhD student then:
P.A. Gagniuc, C. Ionescu-Tirgoviste, R.G. Serban, E. Gagniuc. Photon-pixel coupling: A method for parallel acquisition of electrical signals in scientific investigations. MethodsX, 6:968-979, 2019.
To read more analog channels than inputs you have, an analog multiplexer is a good option. All the ones you suggested will work, but personally, I like the Analog Devices ICs for analog circuits, so I would take the ADG708, but this is just a personal preference.

Resources