Arduino com PIC

Pessoal,

Não sei se é apropriado chamar "Arduino", mas encontrei na Internet esse projeto que utiliza um microcontrolador PIC18F2550.

http://www.hackinglab.org/

Eu sempre me perguntei o por quê de não se utilizar no Arduino um microcontrolador que já tivesse USB como o PIC18F2550 ou o PIC18F4550?
Já imaginaram um Arduino com o PIC18F4550? A PCB ficaria muito simples de ser feita em casa e não seria necessário utilizar aquele chip USB que atualmente é caro, difícil de encontrar e ainda por cima difícil de manipular para um hobbysta.
Nesse link tem até uma versão em que foi utilizada a mesma padronização do Arduino.
http://sites.google.com/site/funlw65/electronics/jaluino-pinguino-28-pins-starting-bo/freejalduino

Eu sei que não está muito bem desenhado, mas vamos dar um desconto já que é uma versão apenas para teste. O importante é visualizarmos as possibilidades. Um PIC18F2550 eu já encontrei até por R$ 14,00 e um PIC18F4550 dá para encontrar sem problemas por uns R$ 25,00, creio que vale bem a pena para quem está pensando em montar o seu Arduino em casa. :wink:

Abraços,

Entao,

Não vejo muitas vantagens de se utilizar o processador PIC para uma plataforma como o Arduino, no entanto vou apresentar alguns fatos e deixo você decidir o que é mais interessante.

Atmega

  • Suport a C, tem um próprio GCC, AVR-GCC, open-source www.avrfreaks.net/AVRGCC/, programar em c é bem mais amigável a não ser que você queira algo bem mais controlado e tenha que usar Assembly.
  • Arquitetura do processador moderna, 1 instrução por clock
  • Fácil de gravar, com um simples cabo serial ou paralelo você pode queimar seu HEX
  • Em geral Atmel é mais barato que Microchip
  • e o Arduino, bom, exitem um comunidade ativa enorme atualmente, www.arduino.cc , e muitos codigos exemplos etcc
  • multiplataforma, mac, linux, windows www.avrfreaks.net

Pic

  • Suporta C, mas ainda é necessario algum trabalho direto no assembly caso queira fazer algo muito complexo, o melhor compilador para C só funciona no Windows, aliás tem um que é pago
    HTSOFT - Your MacOS software library e não custa barato.
    Para linux o SDCC http://sdcc.sourceforge.net/ que ainda esta em fase de desenvolvimento para as linhas de processadores da Microchip, visto que sua comunidade é bem menor e também a alguns fatores limitantes da arquitetura do processador, por exemplo
    mudanças de bancos de memória, set de instruções limitado.
  • Em geral você precisa de um circuito ativo e um pouco chato para poder gravar os PICS, disso isso se comparado a facilidade de se gravar um atmel.
  • arquitetura de umas instrução por cada 4 clock
  • comunidade www.piclist.com
  • tentativas de plataformas como a do arduino,
    PICAXE - Wikipedia
    BASIC Stamp - Wikipedia

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1249502971/4

é isso

Radamés

Radamés,

Concordo parcialmente com o que você falou, mas por outro lado...
Veja que o Pinguino tem um bootloader que permite que se utilize uma IDE praticamente igual ao do Arduino.
Claro que a coisa ainda está muito embrionária, mas o fato de não precisar utilizar um chip dedicado para comunicação USB me pareceu muito interessante e creio que essa será a tendência.
Eu tenho alguns Arduinos Severino montados com Atmega 168, mas eu tenho vontade de montar uma versão USB. Para mim o grande empecilho é esse chip USB, pois além de ser SMD (que não é tanto problema assim) custa muito caro (encontrei por uns R$ 25,00).
Eu ainda não montei esse PINGUINO porque não tenho disponível no momento o PIC18F2550 (só tenho um que está no meu PICKIT2 clone), mas assim que sair a versão que utiliza o PIC18F4550 vou montar um para fazer uns testes já que tenho alguns desses PICs sobrando por aqui.
Creio que esse projeto do PINGUINO só vem a acrescentar e como já falei essa idéia de utilizar um chip que já tenha suporte USB é muito boa. Tão boa que deveria ser avaliada pelo pessoal que desenvolve o Arduino.
Para mim a coisa é bem clara: se o Arduino utiliza um chip FTDI para comunicação USB porque não utilizar logo um microcontrolador que tenha esse hardware. Por que não?
Você falou que os PICs são mais caros (concordo), mas quando temos que utilizar um chip para o USB essa diferença se inverte completamente.
Posso estar enganado, mas achava que o projeto Arduino não estava preso a micrcontrolador. Para mim o que importava no projeto era a linguagem, IDE e o bootloader.
Pergunto mais uma vez.... Porque não utilizar logo um microcontrolador que tenha USB disponível no seu hardware? Por que não?

Abraços

concordo com você quanto ao problemas da conversão usb serial necessária para os atuais modelos de arduino...
da uma olhada nesse thread do Paulo Gonçalves...

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1249590634/3#3

Vamos ver se esse tipo de approach evolui nas próximas versões do arduino...

Aqui em sampa eu acho o ft232 por R$ 12.50, nas lojas da santa ifigenia..

até...

Radamés

Eu tinha visto esse projeto, vamos ver se a coisa evolui...

Esse chip USB por R$ 12,50 até que está razoável, mas convenhamos que mesmo assim ele fica mais caro que o próprio microcontrolador já que os últimos Atmega 168 que comprei na Futurlec saíram por menos de R$ 8,00 a unidade.
Por falar nesse chip USB eu estou tendo dificuldades em encontrá-lo por um preço razoável. Você tem idéia onde posso encontrar esse chip e que, preferencialmente, venda via Internet?
Até na Futurlec estou com dificuldades para encontrar esse chip. Será que estou procurando errado?

Abraços

Well, it works nicely! And I think some of Arduino shields can work with this board. At least, protoboards will work for sure :-P.

Here you can see it:
http://moriscanet.blogspot.com/2009/09/freejalduino-test-blink-led-with.html

Regards,
Vasi

Hi,

This is the last version developed with 18F2550:

And here is his page (and eagle files).

Very nice Vasi

how do you compile C sketch to pic microcontroller?
Is there any open-source compiler for linux OS?

Hi,

There is Pinguino project which use SDCC C compiler (Win, Mac, Linux) to provide Arduino sketch compatibility. Though, it is only a C and not C++. Some classes are simulated via a parser but this is made under the hood.

Anyway, personally I use JAL (this compiler is also available under Win,Mac,Linux) language which produce a much smaller and faster code.
I'm using the board with an USB bootloader but also directly with Pickit2 programmer when I test other compilers/languages.

Here are some links for anyone inteested:
Jallib group - a discussion group about JAL libraries development
Jallib code - Jallib project hosted onGoogle code
Just another language.org - The official site of Jallib project which include tutorials and free books (entire project is free, open source)

Vasi

Here is the new documentation and some examples in HTML format.
And here is the development package.

As novelties, here are:

  • text scroll on 4 seven-segment digits same time with LED "moving lights" (some kind of multitasking - see this movie);
  • reading a temperature sensor DS18B20.

EDIT: Links repaired, sorry!

Galera já portamos muitas bibliotecas do Arduino para Pinguino, procurando manter a máxima compatibilidade entre os sketchs:

Bibliotecas para: servos, LCDs, GLCDs e muito mais...

As bibliotecas LCD e GLCD, Eu mesmo as portei, e procurei deixar a compatibilidade praticamente ao nível de copiar e colar...
;D

Só para adicionar que existem ainda chips que comunicam através de UART... coisa que um chip com USB provavelmente não terá.

Mas cada caso é um caso e deve ser ponderado no inicio dum projecto. No entanto, só de pensar no pesadelo que é configurar um PIC com as mudancas de bancos, prefiro ter mais um chip na placa e usar AVR.
Existem já AVRs com USB, mas são de 32 bits e mais virados para o mundo dos DSPs.

Só para adicionar que existem ainda chips que comunicam através de UART... coisa que um chip com USB provavelmente não terá.

Nope, UART is also there, ready to be used. Yes, you can have two variants of ported libraries which use UART - with Serial USB, or with UART if you want to adapt the code for yourself.

Mas cada caso é um caso e deve ser ponderado no inicio dum projecto. No entanto, só de pensar no pesadelo que é configurar um PIC com as mudancas de bancos, prefiro ter mais um chip na placa e usar AVR.
Existem já AVRs com USB, mas são de 32 bits e mais virados para o mundo dos DSPs.

I don't argue on this. For a poor student, the availability and price of AVRs are the main problems where he lives. So, an alternative had to be created. This is what is Pinguino today. An alternative with a cheap and common microcontroller. If ATMEL problems (the ones above) will ever change, be sure that the right micrcontroller will be chose.
But we can't wait so we must continue to prepare students, learning them Arduino language, being able one day to address any of microcontrollers, better prepared than others... I hope you now understand the big picture.

Vasi

Amazing what Google Translator can do... or do you speak Portuguese? If so, why in English?

Yes, but is it an hardware UART? Or there's a library with a software uart made? I'm just curious and like I said haven't worked with PICs in 10 years.

ATMEL is expensive compared to Microchip?

I understand the big picture... it all boils down to availability and price for the entire thing, peripherals, programmer, compiler... however, Arduino isn't for me a language that prepares students for the future. Teaching them Arduino or C, it is much better to teach C as it is widely used both in computers and microcontrollers and if learnt from scratch can be better understood if only adapting knowledge from the Arduino.
And to learn microcontrollers the language is the least important point. Understanding the hardware inside the chip and how to use the configuration registers is what matters. :wink:

Yes, is Google's fault - I'm from Romania.
Working with peripherals and registers can be easy when you understand the mechanism. It was easy for me to (after I saw an example) set a digital pin as output and input (beyond pinMode() and digitalWrite() ) when I tried for the first time an ATmega32/644P after months of PIC programming. No big deal. Only at configuration bits I got toasted :smiley: . But only once.

Thanks to mikroElektronika, I can program in C, Pascal, Basic, both types of microcontrollers, and using even the same board layout. So, no problems at all. See my site:

  • ATMEL online only Arduino language for now.
  • Microchip various languages. BTW, bank problem is automatically hidden by many compilers/languages so programmer is not aware of.

Yes, here are PICs with hardware UART and others without (in this case you can use only software serial).
Now Microchip produce a PIC at 16MIPS, with ATmega328 performance but double flash and RAM memory. You can build with it a compatible Arduino/Sanguino board, at hardware level, using the same FTDI chip or using a variant with USB native. But I think you saw already many boards Arduino like which use different micrcontrollers - also here not big deal.

What I'm trying to say is, you must be able to deal with any microcontroller available on your zone, in a similar way or better. Arduino language was chosen because of the huge existing database. And it proved to be a bridge between the worlds.

Arduino 'language' doesn't help at all. I don't see it as feature, just as there's nothing fun about programming pascal! heh..
Now, that's just me. A "clone" that you program transparently on the arduino ide sure has it uses.

The bottomline is avr-gcc vs jal or whatever... from a first impression gcc wins, you can compile c++ for instance. Jal compiles ansi C?
Also that statement that on PIC you often need to get down to asm, true?

Albeit we really should take our hats off for microchip for selling a DIP chip with HW USB, no one mentioned V-USB... which works great.
And doing a lil price research on futurlec, the PIC usb chip was $2 dollars more than a atmega32. (24 i/o - 2 for vusb). Please correct me, there are tons of models and I know nothing about pics...
And there's some libusb-ready fw for those usb enables pics? Something like LUFA?

JAL language started as a subset of VHDL language and now it is close to Pascal. No chance to compile C language :slight_smile: . But is the best free compiler around here which can fight with commercial ones from equal positions. It is the best for PIC12/16 families and good enough for PIC18 family. Going down to assembler? With a good high level compiler as JAL you don't need to. But if you want, JAL include also assembler. JAL is easy to learn.
The free C variants (we also have C++ for PICs) here are in no way better than JAL in the resulted HEX file.
Unfortunately, and I don't know why, Microchip don't want to release for free his PIC C compilers and I mean the ones with the full optimization. We always wanted to have a GNU C compiler as AVR programmers have.

V-USB is great indeed, it would be great to be ported also for PICs. It can't compare with a HW USB (you obtain with V-USB only 1Mb/s transfer and the HW can do 12Mb/s) but is still great.

It is a little unfair to compare the prices for ATmega328 when it can't be supplied anymore in DIP package - is missing also form two online shops from my country, where I have access. We have plenty of AVRs here - Romania is in Europe :).

But is not about me. Is about South America and other countries with difficulties in obtaining ATMEL microcontrollers. And when this is happening, an ATmega will be always expensive. If you read the thread from the beginning, you can have a right image about. For them, Pinguino is a nice solution. For others, is fun to play with it and to contribute to a better language compatibility.

The free C variants (we also have C++ for PICs) here are in no way better than JAL in the resulted HEX file.

You would still have to learn a new language. Ok, not a big deal and it is knowledge that you rack up, but if you want to develop fast, you may not have time to mess around with the language.

Unfortunately, and I don't know why, Microchip don't want to release for free his PIC C compilers and I mean the ones with the full optimization. We always wanted to have a GNU C compiler as AVR programmers have.

Stop buying their chips... I can guarantee you that if their sales volume dropped because people preferred to use AVR-GCC for free, the C compiler would be given on MPLab. If I remember correctly, the AVR family started after the PICs, so to make the chips more appealing they released the C compiler. I'm doing a bit of guessing here but I'm very likely to be right.

It is a little unfair to compare the prices for ATmega328 when it can't be supplied anymore in DIP package - is missing also form two online shops from my country, where I have access. We have plenty of AVRs here - Romania is in Europe

I just bought a ATmega328P in a DIP package... in Singapore. :\ It is also easily available through Europe.

Now... this is becoming very similar to posts like VHS vs BETA or MAC vs PC or the latest iOS vs Android.

In the end, what matters is that the job gets done. :slight_smile: Like I said, the important things about microcontrollers are to know how to configure the registers (fuses, etc) and I learned that on a PIC, and when I moved to 8051 or AVR it was as simple as reading a manual to find out where these registers were. And also knowing Assembly. You don't have to program with it, but knowing it helps when using higher level languages so you can understand how some code is going to be "translated". The rest is not as important. :slight_smile:

Thanks for the clarification. I'll stick with avr too.

I don't think 328 aren't made in DIP anymore, otherwise arduino itself would have to be redesigned in the uno.
And it's available in futurlec, I'm buying from there.
Tayda didn't even got`em in the catalog yet, its out of 168 stock..heh
Anyways, the point is, south americans w/o avr access or a) don't have a international c/c b) doesnt know a china e-shop.