[ 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: 44 KB, 721x900, Pigeon-3.jpg [View same] [iqdb] [saucenao] [google]
196432 No.196432 [Reply] [Original]

Hey /diy/ I'm looking to get into programming into micro controllers and stuff. I work at Maplins and was asking some colleagues today what I should be looking into. One of them said a PIC Programming interface but they didn't elaborate just what it does.

So my first question is what the hell does it do?

When looking to purchase one, what should I look for in particular?

One project I would like to create is something of a dream detector. The vague idea is to have something like an infrared sensor to detect REM.

>REM = Rapid eye movement meaning actual random eye movements

Then once it has been detected, I want the device to log how long the REM last for, during what time etc. It will fit on the face like an eye mask right above the eyes.

But I don't know if a infrared sensor is intricate enough to detect REM. Also is it safe to have infrared infront of your eyes like that? If not does /diy/ recommend something else? Is there rating a rating system for different levels of infrared sensors?

>> No.196434
File: 104 KB, 316x455, bumb_4.jpg [View same] [iqdb] [saucenao] [google]
196434

Felt like self bumping

>> No.196440
File: 42 KB, 480x360, He never asked for this.jpg [View same] [iqdb] [saucenao] [google]
196440

Guis?

>> No.196448

Look up openeeg.

>> No.196449

PIC is a line of low-cost ($2-$10) microcontrollers made by the compeny Microchip. The whole IDE (Interactive Development Environment) is free, and you can get a development board (with a screen, leds, buttons, etc... to test your programmed chip) for about $25 on ebay (look for Sure Electronics (chinese outfit)). The "programmer" the thing you plug into your computer and you plug in your chip to program it, costs about $20 too.

>> No.196451

>>196449 <-- same guy.
The steps go like this:
1) you write a program in the IDE in either C or assembly (assembly is actually pretty easy, you just download the chip's manual from Microchip).
2) you plug in the chip into the programmer and "flash" the compiled program into it
3) you test the chip with the development board to debug it
I can send a scan of my course materials, if you want, but they're in French. In any case, there's a load of tutorials out there.

>> No.196454

>>196448
Thanks will do.

>>196449
When you plug in the microcontroller into it and program it, you use the development board to test it and what not right? Then with that chip I have just flashed with my code can I use it to create a device?


>>196451
Yes! Please do! I would be much appreciated! What kind of stuff do your course materials base around? Like the projects itself?

>> No.196458

>>196449 <- Samefag
The PIC would only be the dime-sized "brain" of the mask. You'd make a circuit board with a power-source, and whatever sensors you need (no idea).
The chip could be program to write the times each event happened at to it's memory, but I don't know if it's easy to do this. If the mask can have cables leading to/from it, you'd put this thing (which holds the PIC) http://cgi.ebay.fr/ws/eBayISAPI.dll?ViewItem&item=230706552393&ssPageName=STRK:MEWNX:IT&
_trksid=p3984.m1439.l2649#ht_3391wt_957 by your bedsite table, and have cables run from it to the mask (only the sensors are on the mask), and have a USB from the board to the computer.
You can program the PIC to just get input from the sensors and send it to the USB, and window/linux/fagOs would do the actual logging.

>> No.196462

>>196454
They start REALLY basic. Like: you want a led to turn on when you press a button.
Let me see if I still have them...

>> No.196465

>>196458
Yeah I was hoping for the device to have like a battery power it and it logs this information onto memory within the device or to some sort of USB peripheral? If not i'll do it via this method you have just given me and thank you very much for linking me this.


>>196462
Yeah go ahead! I literally haven't done anything with PIC/micro controllers and stuff so even stuff like that would be fun. How do you plan on sending them? Should I give you my email address?

>> No.196469

>>196465
Ok. The course is here:
http://www.lsis.org/master/documents/micro/Cours.pdf
The LED exercise is in page 79.
And really, all you need to know as a guide is what chip-makers call 'datasheets', which are like 200-page REALLY detailed (and well indexed: you don't have to read from 1-200) manuals for each chip.

>> No.196472

>>196469
Thanks man much appreciated! Looks like me and a french friend will both be learning how to program micro controllers...

>> No.196474

>>196432

Don't buy electronics from the shop you work at. They're overpriced (e.g. the ancient Velleman 8048 that uses serial instead of USB is £40 odd).

To get started you'll need:
> a programmer - this writes your program to the chip which runs the code when it's powered on

> a PIC the thing that runs the program.

> miscellaneous electronics - voltage regulators, assorted capacitors, some oscillators, some 74xxxx ICs are a good thing to start with.

The best thing to do is look at PIClist for some demo circuits and code and take it from there. The datasheets for the PICs are essential reference to have to hand.

Farnell do free shipping on all orders (there's a minimum spend for card payments), Mouser and RS are also good suppliers.

>> No.196476

>>196474

Forgot to mention, the PICkit is probably the best programmer you can get. There are cheaper clones on ebay too.

>> No.196477

>>196472
You're Welcome ! Goog luck, man.

>> No.196485

>>196474
Yeah some of the shit they sill is a bit...you know.

Alright i'll look into that. Do you have any links specifically as a personal recommendation?

>> No.196489

>>196474
when you say a programmer, do you mean me myself and I or the software that comes with the kit itself?

>> No.196492

>>196485
>>196489

I'll link to parts on Farnell, but shop around, you'll probably find them cheaper elsewhere.

A "programmer" in this context is something that writes your code onto a chip, like this one: http://uk.farnell.com/microchip/dv164120/starter-kit-pickit-2/dp/9847162

The PIC16F627A (catchy name!) is pretty versatile, the internal oscillator makes setting it up a case of just powering it. http://uk.farnell.com/microchip/pic16f627a-i-p/ic-8bit-flash-mcu-16f627-dip18/dp/9760334


Having said all this, I don't recommend you start with PICs. There are better things out there (where better = easier to learn).

There's the Arduino, the easy-mode version which includes a nice IDE and does everything for you. If all you care about it making devices work, get one. They're not the cheapest way to do it, but they'll get the job done quick.

If you still want to learn more about microcontrollers, like the art of figuring out how to get them working outside of a board someone else made, TI's MSP430 line is worth looking at. It's a lot more modern than PIC16 and the development toolchain is better (GCC versus Hi-Tech PICC).

The Launchpad MSP430 dev kit is cheap enough to give a go either way, TI will ship them to you free for $4.30 from their store: https://estore.ti.com/MSP-EXP430G2-MSP430-LaunchPad-Value-Line-Development-kit-P2031.aspx

>> No.196494

>>196489
You download the (free) software (IDE), and you write a program on it. The programmer is a mouse-sized machine that you plug to your computer via USB cable. You plug in your chip to the programmer. You click a button on the IDE, and the programmer writes (flashes) it to the chip.

>> No.196498

>>196492
Thanks a lot for all that information man. Honestly, I really appreciate it. I may take your advice and get accustomed with Arduino first then move to PIC's. They seem more versatile and more feasible for some of my other projects.

Thanks again man!


>>196494
Thank you too for explaining it.

>> No.196508

throwing in my $.02
if you're doing this in a linux environment, the support for PIC micros isn't very good. however the support for atmel micros is really good.
>fuck year avrdude

>> No.196511

If you are starting off with microcontrollers, get an Arduino, they are easy to code for, cheap and great for getting an understanding.
Pics are great but require more expense in time and money. Move up to the PIC after you have done some arduino projects

>> No.196512

>>196508
I've never really farted around with linux a lot tbh. It is on my to do list though. I'm still an amateur programmer who can only do beginner level programs in stuff like C++ and C#, both modular programming. I'm about to learn OOP and EDP soon enough.

ATMEL Micro's? I'll look into those too.

There's a lot more to research than I had expected but I guess starting somewhere easy like Arduino may be a good place to start.

>> No.196513

>>196511
Thanks for the advice, i'll probably take that route tbh.

Thanks for contributing (Y)

>> No.196516

>>196512
arduinos are a fucking great place to start. tbh i'm so lazy they are the only micro platform i use.

>> No.196528

>>196516
LOLZ From what i've heard to them I can begin to understand. When I get paid next month i'll purchase one for myself and start another thread letting /diy/ know how it went.

I've got 6 weeks left of college and I've got buckets of shit loads of coursework to complete. After that, once the summer holidays start I'll devote tons of time to this as I've got an invention I too hope to create.

>inb4 "don't get ahead of yourself OP"

>> No.196530
File: 321 KB, 1280x720, IMGA0184.jpg [View same] [iqdb] [saucenao] [google]
196530

>>196489
When we say "programmer" we mean a special piece of hardware that lets you download code from your computer to the chip. Here's a picture of my setup. The programmer is the "PICKIT 2" in the back. They cost $20 from Ebay. It connects up to the chip, and the chip also has an external oscillator on it.

You should get a development board if you're a beginner, so when something doesn't work you know it's not a hardware problem. A development boards is a microcontroller with oscillators, buttons, LEDs, and other things for you to play with on it. Once everything is running fine on the development board you can design a board of your own that has the specific parts you want.

>> No.196541

>>196530
Ah nice man this is all very informative and very interesting. Thanks for the contribution.

What were you making/testing in that photo?

>> No.196560

If anyones still here I was wondering once something has been flashed onto a micro controller with the Arduino, does it need to arduino to operate from then on or can you make the device without the need of the Arduino?

Apologies if it sounds like a noob question.

>> No.196571

>>196560
The Arduino is the little board with the microcontroller (and a little bit of support circuitry) on it. Once you've put something into its flash, it'll stay there until you reprogram or erase it, and it can run without help from the host computer etc, so you can unplug it from the computer and put it inside something else, if you want.

One of the things that makes arduinos an easy way to get started is that they come with a small amount of firmware already loaded that lets them self-program over a serial or usb port. If you start with a bare chip, you'll need a specialized programmer to get any firmware onto it (the programmers aren't all that expensive, but they are yet another thing you have to deal with).

>> No.196572

or... are you asking whether you can build a prototype using the arduino stuff and then make more without it? You can, but you'll need a programmer. (Conveniently, you can program an arduino to be a programmer, or you can just buy one for like $25.)

>> No.196573

>>196572
http://youtu.be/30rPt802n1k

Something like this? Ignoring this arseholes smug look through out the entire video, he basically says depending on the scale of the project you can use only the chip used to operate from then on, right? Correct me if I'm getting any of this wrong btw.

Basically can I upload my program onto the chip and build a board of my own like he did or will my project forever need an arduino to operate?

>> No.196577

>>196573
yeah, you can totally do that. Going from one chip to another, like from the ATmega series (that the arduinos use) to the ATtiny series (that are ... um .. tinier) usually means you have to tweak a few things in your code, but usually it's just trivial stuff like "the button is connected to pin 5 now, instead of pin 17".

>> No.196579

>>196577
Ah right I understand, that's perfect. My projects seem more and more feasible now.

I must bother you with one last thing. Hows your background knowledge on infrared sensors? Do you know if having an infrared sensor directly infront of your eyes will damage it and if so, do you know if there's a specific type infrared sensor I should use?

If not, do you know any sort of intricate sensors?

>> No.196642

Easy Method: Arduino
Pros:
-Rapid prototyping
-Easy to program / wire
-Lots of community examples and support
Cons:
-Expensive
-You don't actually learn jack shit about MCUs

Hard Method: PIC/ATmega
I prefer Atmel's ATmegas myself, but PIC works as well. I personally thing the ATmegas are easier to understand.
You're going to need a programmer of some sort. Pickit for PICs and Atmel MkII for ATmega.

Learning Method: 8051/MSP430
8051 was an MCU that was extremely popular years ago, and you can still find development platforms for it. Although it's obsolete, it's a great place to start learning. Texas Instrument's MSP430 is also very simple and is probably enough for your project. You can get the TI Launchpad for $4.30 incl. shipping and have everything you need to start programming.

>> No.196648
File: 106 KB, 1263x711, Capture.jpg [View same] [iqdb] [saucenao] [google]
196648

>>196579
There are two types of infrared sensors: Active and passive. Active sensors shine out some light, then detect it bouncing back. Passive sensors just pick up ambient IR. I'm not certain if active sensors produce enough light to damage the eye at extreme close range, but best to go with a passive model.

>>196560
If I understand correctly you want to first use an arduino, then go to your own microcontroller board. You can use the arduino for prototyping, but you can't take code you've written for it and dump it onto another microcontroller. Arduinos use a programming language called processing, and its designed specifically for the arduino hardware so beginners don't need to worry about a lot of things. If you want to design your own board you'll need to use the exact same microcontroller and clone a lot of the arduino's hardware for it to work.

>>196541 What were you making
Pic related. 380 directly addressed RGB LEDs. They can scroll text, PWM fading, respond to sound, etc. They're going in a colander, which is my entry to an amateur fashion show where you design hats for drag queens.

>> No.196655

>>196642
True. But learning the PIC or ATmega tools and peripherals opens up more options. PIC and Atmel make a full range from 8 to 32 bits. Some even have audio DACs, USB, or even Ethernet!

>> No.196991
File: 32 KB, 497x500, 18738.jpg [View same] [iqdb] [saucenao] [google]
196991

OP here i'm happy to see this thread is still up here. I went to sleep yesterday and thought there may be a chance some people answered some questions that I didn't want to miss out on. Thanks guis!

>> No.197003

>>196642
Seems like the best method is to literally start with Arduino, become acquainted with it all then move on to the stuff that are more definitive.

So many names of stuff lolz good thing im saving this html page.

>>196648
Yeah I better look into a passive IR sensors.

So I can't do something like this with all projects?
>http://youtu.be/30rPt802n1k

Sounds cool I've always wanted to make a set of LED's that respond to sound. Would be cool to watch with music playing in the background. >adds to list of stuff to want to make


>>196655
Can't wait till I learn all of this stuff. Really excited!

>> No.197009

Btw guys is this what I think it is?

>http://www.geocities.jp/arduino_diecimila/obaka/project-2/index_en.html

>> No.197147
File: 77 KB, 900x900, RBBB_Assembled_1.jpg [View same] [iqdb] [saucenao] [google]
197147

>>197003
An Arduino is just an ATmega8 / ATmega328 / etc with some minimum support circuitry and a pre-loaded bootloader, plus (on the computer side) a nice beginner-friendly IDE and a bunch of useful (but kind of limited) libraries. If you're programming an Arduino you're basically just programming an ATmega. The skills transfer easily.

(ATmega is a subfamily of Atmel AVRs.)

>>197009
Yep. Also see the RBBB Arduino (pic), slightly less crazypants.

>> No.197262

>>197147
Fucking nice man! Much appreciated

>> No.197274

test post

>> No.197275

test post 2

>> No.197276
File: 29 KB, 500x438, 184924_10150100231682459_826412458_6009841_7789920_n.jpg [View same] [iqdb] [saucenao] [google]
197276

>>197275
What is it friendly neighbourhood Spiderman?

>> No.197278

>>197276

Testing my 4chan parser's name handling. It worked!

>> No.197297

>>197278
I know what that is(!)