[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/diy/ - Do It Yourself


View post   

File: 696 KB, 750x578, Fig9.png [View same] [iqdb] [saucenao] [google]
1119740 No.1119740 [Reply] [Original]

Hi guys. Arduino thread here. So i will have an arduino controling my plane in the air. The battery(LiPo) is only connected to the esc
So what can i use to power the arduino board itself and keep it for some time. Also i need something light.
As i might know you will say it depends on what it does, it is connected to telemetry RF , gps module, gyro module , 2 led's , 4-(9g) servos and it think that's it.

>> No.1119766

The ESC usually has its own 5v regulator for things like arduinos and servos

>> No.1119885

if your're worried about lightness get an attiny or atmega and solder it to perfboard

>> No.1119892

>>1119740
1. Get an esc with a bec.

2. Why not uas a r/c receiver?

>> No.1121673

>>1119766
This.
Also given that OP didn't know this he should stay the fuck away from RC planes.

>> No.1122301

what's the difference between arduino and raspberry pi?

>> No.1122562

>>1122301
Simply speaking arduino is a microcontroller while rpi is a computer.

>> No.1122728

>>1119740
>Arduinos

so, these would be good to control something like a small, semi-autonomous robot car?

What if I wanted to make a tiny robot car that could drive itself around my apartment and make a 2d map of the floor layout, mapping and recording the size, shape and locations of obstacles such as walls and furniture, etc.

what sort of programming would;d be necessary top for it to basically catalog objects in a Cartesian coord system, and also keep track of its own location within the map?

>> No.1122737

>>1122728
Seems pretty complicated for beginners desu
You should try anyways

>> No.1122743

>>1122737

I think the basic movement and object/barrier sensing functions should be the least difficult. I have some ideas on how to go about that part. Probably do the project in stages and that would be stage 1. to move autonomously and avoid object with on-board sensores

Now the major challenge i foresee is how am I going to log the sensor data in a way that assign 2d coordinates of object and barriers and somehow catalogs them into a digital on-board map of sorts?
that would be phase 2

The 3rd phase would be, how can I program the robot to acquire 2d coords. of its own position relative to other objects in the map, and how to get it to record or reference its own position while moving around in real time.

phase 4 would be to assign it tasks or points of interests to visit and have it maneuver its way around the apartment using the on-board map data, avoiding known obstacles

phase 5 would be to make scan for and create it a 3d map, to include walls and ceiling boundaries, this might require and airborne unit, some type of miniature flying drone

Perhaps the data could be streamed via radio or bluetooth back to my laptop where, presumably I could use a more advanced Program and the more powerful PC to process this data and send back the finished map to the drones in intermittent data packets

>> No.1122864

>>1122743
Look up "diy roomba".

>> No.1123420

>made an airboat
>radio-controlled, electronics work pretty well
>powering it with 3x3.7v li-ion batteries in series

Ok, now how can I read the battery voltage? Can I simply use a voltage divider and feed it straight into an analog pin?

>> No.1123610

>>1122728
Try STM32 board from StT microelectronics. Beter than arduino for fast and heavy program have lot of memory. Also cheaper. Easy to program with good library. (Because arduino library are really written by retard)

>> No.1123642

>>1123420
with RC parts?
The ESC will automatically go into low power mode when the voltage gets too low
Also look up RC battery monitors they are lik $4

>> No.1124754

hey. I'm looking at making a quantizer but I'm not exactly sure how to program scales.
A quantizer takes a voltage and rounds it of to intervals, for controlvoltage for synthesizers.

basically what i need to do is to round off a value to a list(array?) of values.


for chromatic(every note) I can just take an analogRead and crushing it down to 60 with a map function. (5 volts to work with, 1v per octave = 60 steps)

but for other scales I need to be smarter.
how do I constrain a value to an arbitrary set of steps?

>> No.1125063

>>1123610

>>This post was written by retard

>> No.1125078

Do I need to know C to run an Arduino (or run it well)?

I know Java and C#, and I'd rather learn Python than learn C.

>> No.1125082

>>1122728
>wanting to use Cartesian coordinates to map your surroundings

The world is a circle, use polar or spherical or it won't make any sense when you get to the corners

>> No.1125588
File: 2.42 MB, 380x214, TrumpShrine.gif [View same] [iqdb] [saucenao] [google]
1125588

>>1125078

C++, and it's a fair bit easier than C, but still way harder than Python. I would recommend learning it.

>> No.1125592

>>1124754
If you do an analog read you are using the adc to covert an analog signal into a digital value. That is pretty much the definition of quantization.
Your number will be probably 10 bit? So 0 to 1023 (2^10). To resale it you divide by 1023 then multiply it by whatever the maximum value you want is. Say you want it to be 0 to 255 (I picked an easy number on purpose) you do analogread * 255 / 1024. Then you can simplify it (probably compiler will do this anyway for you I hope) analogread / 4.
Just be careful multiplying while numbers and floats and shit. If you divide while numbers the result might be a while number instead of a float it will be rounded off.

Don't they teach you maths in school?

>> No.1125601

>>1125078
You don't need to know anything at all its literally programming for the retarded everything you will ever interface with our do has a library written for it by some do gooder you just glue it together like Lego and copy it all.
If you know c# you can do cpp, c# is just Microsoft libraries on top. Python isn't a language it's an abortion fucking indentation controlled scope where you can't mix tabs and spaces who the fuck thought that was a good idea. As a first language it might be ok because its so fucking abstract and gives a decent jump into some functional paradigms and every other language you try afterwards will be a hundred times less tedious.

>> No.1125620

>>1125078
If you've used Java or C# to any real capacity you're likely in the high level programming camp.

You don't do that kind of programming for embedded environments for performance reasons, executable size and memory constraints mainly.
>>1125588
>C++, and it's a fair bit easier than C
No, not for embedded programming. C++ adds a ton of features you either shouldn't use or won't use correctly. To classify C++ as "hard" for what we're doing here in contrast to python is rather misleading since here we care about our computation more intimately.

Most arduino sketches and libraries have a rather restrained form of C++ where it's almost just C99 with classes (C++ classes, not full blown OOP).

>If you know c# you can do cpp, c# is just Microsoft libraries on top.
No they're very different languages to someone who knows C++ or C#. They're both C-like in their braces and semicolon syntax but that's very minor similarities.

The biggest problem a newbie will have aside from his actual domain problem is probably the implicit casting.

And really any warning you get in C++ should actually be an error. It's a minefield. Especially with the recent trend of compiler writers allowing themselves more liberties with the undefined behavior in the language.

>> No.1125640

>>1125592
>Don't they teach you maths in school?
yeah, did they teach you how to read?
i just finished math in tradeschool.

quantizer is also a synth term, a quantizer rounds of controlvoltage to musical scale intervals.

I need to lock the output voltage to certain multiples of 1/12th of a volt.
chromatic is every step, but other scales have fewer, so i need to 'skip' certain steps depending on the scale selected.

which intervals depend on the musical scale, so i need the program to read a selected list of accepted values and round of to the closest of those values. THEN multiply by 4095(12bit dac) divided by 59(12 notes per octave,5 octaves per volt dac running 5v) to get the desired voltage.

its not a math problem, its a code problem.
how do i scan an array(for example) for the closest value and then return that value?

>> No.1125652

>>1125640
I'm not going to go back to re read what you wrote originally I hope we can just move on.

I'm assuming you have the voltage converted to a note by now and this is ' locking' it to a scale
So there is a trade of I guess you can do a lookup table that will use up a lot of memory where each scale is an array the index corresponds to an input note, the output is the closest note that you work out and put in there. You said you did mapping before is that what you meant?
The trade off if you have cycles to burn you have an array of notes for the scale and go through the array, set a variable to track the smallest difference, initialize it to some large value. take the absolute difference and if its smaller than the smallest value then replace it.
Basically a find min but modify the comparison to calculate the absolute difference.
Any use or am I misunderstanding

>> No.1125656
File: 37 KB, 504x510, Aurduino Micro.jpg [View same] [iqdb] [saucenao] [google]
1125656

The power problem was solved with regards to the ESC / BEC combo.
Now as far as weight instead of that large UNO board that is great with modules, write your sketch to an Arduino micro controller.

>> No.1125662

>>1125640
>how do i scan an array(for example) for the closest value and then return that value?
given x, iterate through the array until you find a bigger number, then check the difference between x and that number and and the difference between x and the next lower number. Return the number with the lowest difference.

//C
int list[] ={3, 7, 9, 15, 21};
int numItems = 5;

int getNearest(int x){
__int i;
__for (i=1; i<numItems; i++){ //iterate from 2nd index to last index
____if (list[i] > x){ //then it's index i or i-1
______//this rounds up if x is in the middle
______if ( (x-list[i-1]) < (list[i]-x) ) return list[i-1]; //or return (i-1) if you prefer
______else return list[i]; //or return i
____}
__}
__//if execution made it here, x exceeded last in list so return highest
__return list[numItems-1]; //or return (numItems-1)
}

//Usage:
int y = getNearest(11);

>> No.1125664

>>1125640
>how do i scan an array(for example) for the closest value and then return that value?
I'm not 100% sure on the issue here but it sounds like you want a binary search? Just add an extra condition that returns when you compare against the same value twice in a row (this would mean that your min and max for the binary search encompass a single range, which means you've found your closest match).

I don't see this being a bottle neck. I'd originally have suggested you build an array which covers the entire range of input values and repeat your output values. Since most microcontrollers nowdays have a lot of memory considering the applications we give them. But it's far easier to write a binary search this way.
https://en.wikibooks.org/wiki/Algorithm_Implementation/Search/Binary_search

https://gist.github.com/anonymous/a0e79374e9235ecf985241bb47ae58b3
Here's something I wrote. It's untested so user beware.
If you understand a binary search this should be quite clear. A binary search is easy to understand. You know you have a sorted array so you just pick the value in the middle, if it's bigger than what you were looking for you divide the lower part of the array and do the same thing, repeat until you find what you wanted.

>> No.1125666

>>1125664
Nevermind. My solution is completely busted.

>> No.1125670

>>1125662
>______if ( (x-list[i-1]) < (list[i]-x) ) return list[i-1]; //or return (i-1) if you prefer
Just noticed that if you pass 1 this fails
should be:
>______if ( abs(x-list[i-1]) < (list[i]-x) ) return list[i-1]; //or return (i-1) if you prefer

>> No.1126241

I just bought a trinket on a whim. I've never messed around with microcontrollers before.

Anyway I wanna do something neat where it collects measurements so I have a set of data to analyze and maybe learn something new about whatever I measured.

What are some cool sensors I could attach/where could I get them? Accelerometer or a laser or something would be real neat. Any suggestions?

>> No.1127448

>>1126241
use the armega for something else
get a few esp8266 with a bunch of temp sensors, make a mesh network, and map the temperature in ur room at different points

>> No.1127458

>>1119740
If you have any old rc cars that are chargeable just salvage the L-ion battery and plug it into your arduinos charging port. I would suggest salvaging a cable that fits in the charging port and wire it to the battery. Then plug in and then your done. Or you could hook up a mini windmill on it.

>> No.1127876

Complete idiot here, I want to get into Arduino but I literal know nothing at all (not even coding). Is there any good place to start? I have been on the arduino site and couple of others and I still don't feel like I'm getting it, plus I working on very limited funds so no starter kit for me. I really want to learn.

>> No.1127880

>>1127876
Learn-c.org

>> No.1127970

>>1127880
thanks anon

>> No.1129699

>>1127448
>armega
I dunno what that is? is that another term for the trinket?

>make a mesh network, and map the temperature in ur room at different points
Wow that's a fucking cool idea. Thanks man! I didn't think I'd get any suggestions.

>> No.1131527

>>1123610
Arduino would be significantly easier to grasp for a total beginner, they would be able to find a lot of example code for just about anything out there from the community as well.

As for the f4 discovery board, don't know how long the other tools like Keil and EWARM take to setup, probably significantly easier but they all have annoying limitations unless you fork out an obscene amount of money for a license.

GNU ARM Eclipse plugin has no catches I know of, took me a while to setup but their website had good tutorials to get up and running with some example code.

I think ST has their own IDE as well SW4STM32, not sure if it has any catches, it would be easier for a beginner to use their graphical tool CubeMX to generate the initialization code since it is supported but you still have to have some understanding of the hardware.

I've tried several of the toolchain/IDE options in CubeMX and non of them compile without modification after importing to eclipse with GCC. For the time being I just grab the files I need and merge it with my IDE's template code provided. Don't think beginners would be happy with it, the supported list of IDEs would be easier to setup out of the box with CubeMX.

Command line + ARM GCC toolchain is another option with some helpful tutorials out there but it requires some understanding of makefiles, hardly beginner friendly. IDE provides you with a lot of tools to work with out of the box even if overwhelming.

>> No.1132013
File: 46 KB, 640x480, 1428728378530.jpg [View same] [iqdb] [saucenao] [google]
1132013

>>1121673
(You)

>> No.1132606

>>1122728
Encoders on wheels could track angle and position. Infared sensors or sonar could make a point map of obstacles, and you could probably set up a system for random wandering while avoiding points pretty easily