Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Where to Start Programming Pics

Status
Not open for further replies.
Whoops- I missed Mike's previous post #10 about using an Arduino.

spec
 
Last edited:
I would also suggest the arduino unless this is a hobby you are interested in getting into deeper. Plenty of libraries and sample code available, by far the most user supported platform.
 
I am guessing that this application could be a remote sensor that is solar powered so it would need to be low on power consumption. The Arduino modules take quite a bit of power. I would choose one of the 8 pin PICs or Atmel chips and try to code it so it went into sleep mode and woke up periodically to send the data. I use a PIC12F1822 together with an HC-12 RF module for a similar purpose but I do not use sleep mode. As The OP only has a PICKit2 he could not use this chip which needs a PICKit3 to program it. He could use a PIC12F629 but that does not have a USART so he would have to create a UART in software. (There are probably many examples of this code on the web.) I can post the code that I use (Which could easily be modified.) if required. It is written in assembler and transmits data from a DHT22 module as an ASCII string.

Edit.
There is code for a softwrare UART for a PIC12F675 (Which is almost the same as a PIC12F629) at the bottom of post #5 in this link.



Les.
 
Last edited:
...
Please recommend a resource to learn how to use these micro-controllers for Aduino. This also looks like a very good option and may have a little less of a learning curve. Although, initial setup may be a little more pricey since I would need to purchase an Arduino.
Start by reading this intro.

Then
read Arduino's official getting started, and then get the IDE from there. Imbeded in the IDE are dozens of demo programs that do basic stuff like blink a LED, read Analog pins, debounce switches, etc.

For further learning, use Arduino's tutorials, or use AdaFruit's Arduino Tutorials.

I would buy my first Arduino Micro from SparkFun.
Use it for initial learning and to check the integrity of the USB connection between the IDE and the micro. You can buy cheap Micros or Minis that become a wired-in permanent part of a project from the Chinese knockoff suppliers, but I would always have a "genuine" board around for debugging.

Two ways to go with the knockoffs:

Get one of these, and many of these. This uses one "programmer" (really a USB to serial converter) and lets you use simpler (lower power consumption) modules.

OR

Just buy these. This has the USB interface on each board.

I have used the knockoffs successfully, but initially had some Windows USB driver issues with them where I had to obtain and install drivers that were not included in the IDE download...
 
Last edited:
I have used the knockoffs successfully, but initially had some Windows USB driver issues with them where I had to obtain and install drivers that were not included in the IDE download...
You can get similar problems with all units, not just clones.:eek:

USB functionality/drivers depends on the USB hardware implementation. On the clones I bought the USB chips were better than the USB chips on the 'genuine' boards.

spec
 
I am guessing that this application could be a remote sensor that is solar powered so it would need to be low on power consumption. The Arduino modules take quite a bit of power. I would choose one of the 8 pin PICs or Atmel chips and try to code it so it went into sleep mode and woke up periodically to send the data.

Good point Les about power consumption- it did cross my mind but the OP didn't mention low power requirements.

You can reduce the power of an Arduino by putting it to sleep: **broken link removed**

Or with a small bit of electronics you can cut the power consumption completely, depending on the application of course.

spec
 
Using the "Narcoleptic" library, I have put the Arduino in a low power sleep mode where it draws less than 10uA @ 5V for the duration of the sleep period.
 
'Nacroleptic library' - what a wonderful title.:cool:

spec
 
Hi Mike & spec,
I did not know that the Aduino could be put into sleep mode. On versions with the USB to serial converter onboard its this device also put into sleep mode ? (The only Arduino I have is the Uno. (This uses a an ATMega16U2 for the USB to serial conversion.) Nice to be proved wrong and learn something new. The idea about the possible low power requirement was just a guess on my part as it sounds like the sensor part will be a long way away from the base unit. I was thiking of possibly a borehole pump or some type of drainage pump.

Les.
 
Please recommend a resource to learn how to use these micro-controllers for Aduino.

An Arduino isn't just a 'chip', it's a complete board and development system - the actual processor used is an AVR one from Atmel (now part of MicroChip).

They are incredibly cheap (or at least the clones are), but still much more expensive than a bare PIC - which as you have a PK2 is all you need really.
 
An Arduino isn't just a 'chip', it's a complete board and development system - the actual processor used is an AVR one from Atmel (now part of MicroChip).

They are incredibly cheap (or at least the clones are), but still much more expensive than a bare PIC - which as you have a PK2 is all you need really.

But can you solder wires directly to the "pins" of a PIC?

DSCN0002.JPG


This happens to be the one I needed to put in a low-power sleep mode for 99.99% of the time. It is a prototype controller for a high-altitude balloon beacon transmitter. It wakes up periodically, keys a transmitter, sends Morse code flight parameters and an ID, and then goes back to sleep. Literally took less than five min. to wire up, download the first iteration of the code, and test the prototype.

Also an example of how the USB-to-serial unplugs from the Arduino after you are through developing the code...
 
Last edited:
... I am trying to monitor if water is present in an open container. Under normal operation, the container will be dry. When container starts to fill with water, I would like to receive an alert...
How do you intend to monitor this? Reason I ask since there are multiple detection methods and they all have different issues.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top