Go Down

Topic: 1 or 2 Arduino's needed? (Read 536 times) previous topic - next topic

Sareno


GoForSmoke

#31
Jan 25, 2020, 03:36 am Last Edit: Jan 25, 2020, 03:41 am by GoForSmoke
I was looking for a unipolar hall sensor that detects and counts the moments that the magnet passes it. This way I only have to detect once per rotation.

Why can I read 6 digital pins? The uno has 13 digital pins or do I miss something?
ATmega chips are 8-bit machines. The ports have 8-bit registers, the CPU can only work on 8-bits at a time.

Have you ever seen a pin map for an Uno?

Quote
Will the 1284P work together with an Uno or Nano?
The Uno is a board with a 28-pin socket that can use ATmega48, ATmega88, ATmega168 and ATmega328.
The Nano is a board with a surface mount ATmega328.

The ATmega1284P is a bigger microcontroller with the same CPU as the others, you can make your own Duino with one the same as you can with an ATmega328. 1284 is 328's big cousin, either can run on their own. The 1284P will let you read 8 inputs in 1 cycle, 62.5 nanosecs quick.

Nick Gammon shows how to breadboard either chip.
http://www.gammon.com.au/breadboard

Quote
Anyway, it has to (edit) detect the revelations and once every 100ms or so, calculate the RPM.

Basically, it needs to detect how long ago the last detection was, this way I can calculate the RPM. So it only has to "remember" the last detection as wel as the shortest (highest RPM). Then, every 100ms or so, write the RPM to SDCard. Or into a variable and then once a 1 second, clear that VAR to SD.

If you try and time single detections you will end up needing to average 10+ since Arduino micros() has a granularity of 4 microsecs and interrupts have an overhead over 5 microsecs on top of the ISR code. Also the faster the magnet moves the stronger the effect on the sensor.

You want RPM 10 times per second? That should be 100's of revs to average out one time +/- 3 usec error.
How fast will these sensors change spin rate anyway?

For light, a slotted wheel can be laser printed black on transparency at an office store. The diameter can be smallish and one printed sheet can have many such on it. The wheel lets you be more accurate, divides error.

1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

TomGeorge

Hi,
Are the 7 shafts you want to measure on your RC all connected through a gearbox, or are they on individual drive motors?

Can you post a block diagram of your RC car and show what sensors you are monitoring?

Thanks.. Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

Sareno

Thanks for all the replies. I thought that I had it figured out but now I am in doubt again. This proves to be more complicated than I thought.

Do you have an example of such a slotted wheel setup, I mean the sensors involved? Again, there are so many options out there.

10 times a second is just a guess btw. I only need (want) the real time RPM from 1 axle (motor). The others are for reference only or for later examination. BUT, because most of the time at least 1 or 2 wheels are spinning I need the slowest to calculate the speed and the distance that I have driven (slowest has most grip so is best to use for actual speed).

I can create a block diagram later on but may you get what I mean by this:




Front:

Left Wheel ---1---- Diff ---2---- Right Wheel

Mid:

Front diff ---3---- mid diff---4----Rear diff

Rear:

Left Wheel ---5--- Diff ---6---Right Wheel

Motor axle (connected to midd diff) = 7

In short; the motor drives the midd diff. From that point on the power is being distibuted through 3 diffs to the wheels. It is an off-road 1:8 Truggy with a lot of power (top speed should be around 100KM/H).

Just as an experiment and to learn (and because it can be fun!!) I want to be able to:

Read Engine RPM Realtime
Log Max RPM
Read realtime speed
Log Max speed
log acc time 0-xxx
Distance driven
Analyze wheel behaviour. When does a wheel (and which) spin? This can help me to setup the suspension or gearing.

I have enough room for Hall sensors like the A3144 but I really doubt I can place slotted wheel setups.








Sareno

What about the Arduino DUE?

Sareno

Hmm, on the first page of this thread we already discussed the DUE and Micro.

I read somewhere that the DUE would be End Of Life but now I see that I can still order it.

The 1284P does not look that powerfull on paper (spec-wise). But I do not know about the inputs per cycle of those other boards.

GoForSmoke

You have a linear Hall sensor that you can read digital (the pin will go LOW to HIGH at around 2.8V and go HIGH to LOW at around 1.1V, word is hysteresis) in groups of up to 8 in nothing flat (1 cycle) ---- or ---- you can read it analog which going from analog pin to analog pin reading different sensors means pin settle time before the read (the chip doc recommends doing 2 reads but only keep the second) and you can get a good read about every 3400 cycles.

Analog read is dead slow compared to digital read.

Hall switch costs about 50 cents where linear Hall sensor costs about 3x as much. For what you want, the switch is good.

Gear tooth counter:  https://www.westfloridacomponents.com/blog/how-do-sensors-measure-gear-tooth-speed-and-direction/

Ferrous metals soak up magnetic field. You can use a linear Hall sensor to see this by putting it aligned in a magnetic field and then bring a piece of steel in to the side to bend the field out of line with the sensor axis (Hall sensor only senses along one axis) and cause the Hall to output lower voltage than when aligned.

You can buy a gear tooth counter, shop around and you might find one for less than $20.

I really don't think that you appreciate how fast AVR chips are. You should be able to read and process 8 digital signals 40+ times per millisecond using simple non-blocking code including direct port reads.

I don't think that you know these chips well and I can't see picking a chip and strategy on slim knowledge.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

Whandall

#37
Jan 25, 2020, 06:29 pm Last Edit: Jan 25, 2020, 06:30 pm by Whandall
I read somewhere that the DUE would be End Of Life but now I see that I can still order it.
You also can use a smaller DUE compatible module



Due R3 Core For Arduino Compatible SAM3X8E 32bit ARM Cortex M3 Module UC-2102 512K Flash 96K RAM 12bit ADC 12bit DAC 84MHz

for around $20. This vendor also has a nice Mega compatible module.
Ah, this is obviously some strange usage of the word 'safe' that I wasn't previously aware of. (D.Adams)

Sareno

Clearly, I have some homework to do. Thanks.

I another thread I was advised to 3d-print some parts to put on the shafts with a magnet and a hall sensor. I will look into the gear counter but again, I do not think I have the space for it.

I will be re-building the car somewhere this week and I will post some pictures to give you an idea of size and space.

Something else just occured to me. Those high RPM's are not for all shafts. The diffs have gearing.

So, The max RPM of the motor is (in theory) 50.000 but that is only 1 shaft.

The main spur gear and pinion are 63 and 18: 1;3.5
The max RPM of the 2 midd axles is: (50.000/3.5); 14285 RPM
The spur and gear of the 2 end diffs are 43 and 13: 1;3.3
The max RPM of the wheel axles is (14285/3.3): 4328

I might be changing some gears but these numbers will give you a way better idea of the real situation. I might change the main spur for a 48tooth but even then, the RPM will never be higher than 16000, except the motor.




Sareno

Could you send me a link to a sensor that I can use with a slotted wheel? I tried to google but all I find are quite big.

What kind of small sensor would I need? I might be able to 3d print small slotted wheels to mount on the axles.

GoForSmoke

In the gear tooth counter article it showed a plastic gear with a thin metal gear on one side to work with a Hall switch.

Without the metal an IR led on one side and detector on the other works as long as the gear is opaque.

There's principles at work in these. Iron grabs magnetic field, changes the strength. Light is blocked or not by the gear tooth. Principles that you apply to fit your car.

Magnetic sensing is not blocked by dirt where a led and detector can get covered with dust/mud. Principles.

If you need extra fast, the Teensy 4.0 is a 32-bit MCU that runs at 600MHz and costs about $20 + shipping. Caveat is that the board is 18mm x 36mm with closely spaced components and contact pads on the underside (rather than pins). Your soldering skills must be very good to attach anything to it. Also the pins are electrically weak, 3.3V with small current limit... AVR pins are much more hobbyist friendly.

I figured that a thin metal gear or slotted wheel shape could be put on the inside side of each car wheel hub and sensor on the wheel suspension to go up and down with the wheel. The shape does not get used as a gear, just has regularly spaced bits that stick up and grab the magnet field.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

Go Up