Author Topic: Need help with a Microcontroller beginners project.  (Read 15377 times)

0 Members and 1 Guest are viewing this topic.

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Need help with a Microcontroller beginners project.
« Reply #50 on: June 19, 2015, 04:01:36 am »
close MarkF, But not quite.

here is a sketch i drew of what i'm after.

Each sensor will be on its own cable, up to 50ft (depending on machine size, as the cable needs to travel through Cable Drag Chains), and have two LED's. The sensors are encased in clear resin, and when the LED lights up, the whole case lights up that color. So the visual effect is neat looking. So, when the sensors is plugged in and in it's normal state, a green LED is lit (or blue if the customer chooses blue instead), and then when the magnet triggers the sensor, it will switch from the green to the red color, when the magnet is pulled away, or the machine is done homing, then it switches back to the green LED...Normal state.

Now, when the user wants the switches to work in normally open mode (instead of the default normally closed), then a jumper is selected and the optomos will switch to that.  So, in Normally closed state (default), the LED inside the optoMOS will be ON, indicating that the optoMOS is fully turned ON and in normally closed mode and will only turn off when the sensor is triggered.  But, if the jumper is selected, then that LED is off and ONLY turns on when the sensor is triggered,  thus, normally open mode. Each normally open or normally closed selection will also have a 2 color identifier to let the user know which is selected.

Now, there will be a front panel that will have the matching LED's of each sensor. So when the sensor is triggered, not only do the colors switch on the sensor, but they also switch on the front panel.

Also on the front panel will be a test switch that will turn on all LED's in the circuit, so that they can be identified easily if one has burned out. That test switch will have a red LED that will turn on when the switch is pressed.

Now, for the rear panel where all the connections for the sensors are made, there will be two LED's on that panel.  A green (or, again, a blue if user desires) and a red. The green stays on, but switches to a red color if a sensor has triggered (ANY sensor).  Kinda like the jack where your Ethernet cable plugs into, as it blinks when data is received.

I also want to make it so later, an LCD or graphical LCD can be plugged in. Later in the future, I want to add features such as monitoring stepper positions that will read out on the display, as well as maybe some other things I may think of, so I will need some extra inputs on the Microcontroller for that.

The rear panel will also have some kind of a plug in sensor on it to monitor if a sensor has been plugged in. If a sensor is NOT plugged in, then all LED's on the front panel for that Sensor jack will be turned off, as well as the optoMOS and NC/NO jumper LED's.  There's no sense in having visual indication for something not even plugged in.

Also, if there is another option...the optoMOS is abit expensive at $0.85 each when bought in 100.  But, I am not sure that a transistor based (i.e. optoisolator) will work.  It might make too much of a voltage drop across the optoisolator.

I'd like to have the voltage down the cables for the sensors to operate at 24volt if possible. That would be at par with some of the more expensive industrial machines whose proximity sensors and mechanical switches operate at 24volts.

Currently, I have four 28awg wires inside the double shielded cable going to the sensors. I would like to reduce that amount, so that the cable can be smaller diameter, if possible.

« Last Edit: June 19, 2015, 04:03:57 am by Falcon69 »
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2544
  • Country: us
Re: Need help with a Microcontroller beginners project.
« Reply #51 on: June 19, 2015, 11:11:21 am »
WOW....
I think you need to go back and define what your requirements are.  You seem to be wanting more and more and still expecting to reduce the cost.  I'm seeing two options here:

LOW COST OPTION:
   1) Add microcontroller
   2) Move as much functionality into software
   3) Keep the hardware to a minimum
   4) Eliminate all LEDs and switches on your main board.  Set the number of sensors and the N/C selection in software when the microcontroller is programmed.  Provide a way to examine the configuration from the front panel.
   5) Combine the Rear Panel and the Main Board into one
   6) No expansion capabilities

MUCH HIGHER COST OPTION:
   1) Add a larger microcontroller
   2) Add a general purpose I/O system (No shift registers).  The I/O would be accessed the same way the microcontroller accesses memory.  With an address bus and a data bus.  It would be expandable from 1 to 256 bytes of inputs and/or outputs.
   3) Allow for LCD or other type of display.  Microcontroller would need extra memory and have a hardware SPI at a minimum.  Provide buttons and/or an Encoder to control the display.
   4) Level shift sensor inputs for 24V option.
   5) Allow for stepper motor monitoring.


As an aside question:
   What do the optoMOS do?  Could they be driven directly from the sensors and not come from the microcontroller?
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Need help with a Microcontroller beginners project.
« Reply #52 on: June 19, 2015, 11:53:20 am »
This $10 PSoC 5LP prototyping kit should fit the bill:

http://www.cypress.com/?rid=108038

Specs and datasheet:

http://www.cypress.com/?mpn=CY8C5888LTI-LP097

But you will have to consider the ramp-up to learn what it can do and how to program it appropriately.

I think it has all the support for everything you need including driving the LCD.

Edit: the prototyping kit is definitely subsidized by cypress because the cost of the actual main MCU is more than the kit, plus the kit has 2 PSoC 5LPs (one used to program the other)

So for something already built into your design you will have to consider the cost per chip (~$10 large quantities) or just make sure you can provision enough prototyping boards :)
« Last Edit: June 19, 2015, 11:56:06 am by miguelvp »
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2544
  • Country: us
Re: Need help with a Microcontroller beginners project.
« Reply #53 on: June 22, 2015, 05:14:07 am »
Each sensor will be on its own cable, up to 50ft (depending on machine size, as the cable needs to travel through Cable Drag Chains), and have two LED's. The sensors are encased in clear resin, and when the LED lights up, the whole case lights up that color. So the visual effect is neat looking. So, when the sensors is plugged in and in it's normal state, a green LED is lit (or blue if the customer chooses blue instead), and then when the magnet triggers the sensor, it will switch from the green to the red color, when the magnet is pulled away, or the machine is done homing, then it switches back to the green LED...Normal state.

Now, when the user wants the switches to work in normally open mode (instead of the default normally closed), then a jumper is selected and the optomos will switch to that.  So, in Normally closed state (default), the LED inside the optoMOS will be ON, indicating that the optoMOS is fully turned ON and in normally closed mode and will only turn off when the sensor is triggered.  But, if the jumper is selected, then that LED is off and ONLY turns on when the sensor is triggered,  thus, normally open mode. Each normally open or normally closed selection will also have a 2 color identifier to let the user know which is selected.

I modified a circuit I'm using for another project that I think will check a few boxes on your wish list for the sensors.  I'm assuming a 20mA current for your LEDs and that the Hall Effect sensors are capable of switching 24V @ 20mA to be on the safe side.  The circuit will eliminate all your configuration switches for the sensors.  It will provide the plugged-in status and the processor will always receive the same True/False state polarity.

Not sure what the impact of a 50 ft cable will have on the LED brightness.  Also, your cable will only need 2 conductors.
« Last Edit: June 22, 2015, 05:17:59 am by MarkF »
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Need help with a Microcontroller beginners project.
« Reply #54 on: June 22, 2015, 05:38:44 am »
Thanks Mark.

My original design called for an opamp/comparator as well, but i took it out and it operates fine without it.

Also, that design will not work. The NO/NC is done at the optoMOS point, not at the sensor point, as the way you show it, the sensor needs to operate as normally open, which just can't happen with a unipolar hall sensor. at least, not operate the way i want. Also, that's just a single color LED visual indication. I'm after a two color set-up.

Yes, the sensor works up to 28 volts and switches up to 25mA of current. the LED's on the sensors are operating at max mA to try and get the brightest possible effect.  Ultimately, with a microcontroller, I'd like a dimming option for this for areas where it isn't so bright and the led's can be turned down.

at 50ft, I'm noticing about a 0.3v drop from mainboard to sensor. so it does effect the LED's a little bit. That is why my current design operates at 5.3v to compensate for the voltage drop along the length of cable.

 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2544
  • Country: us
Re: Need help with a Microcontroller beginners project.
« Reply #55 on: July 04, 2015, 12:36:05 pm »
I ran across the drawings I did on my desktop and I was wondering how you're making out with your design?
I started fooling around with it this morning and put together my initial thoughts of an addressable I/O where you read/write bytes of data.  The drawing shows latches with individual clock lines from a PIC (i.e. PORT_B).  This way you can write to more than one set of LEDs if the data is the same.  There are still a few unused PIC pins if you need more LEDs.  The enables to read the switches are on PORT_E.

I believe 74HC374 Latches can drive your LEDs directly without the need for the ULN2803.

Also, the extra pins on PORT_A could be used for individual LEDs like the 'any sensor activity' indication.

You could eliminate your switches by entering the data via a touch panel display.
« Last Edit: July 06, 2015, 01:57:19 am by MarkF »
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2544
  • Country: us
Re: Need help with a Microcontroller beginners project.
« Reply #56 on: July 06, 2015, 06:21:17 am »
An option to use RGB LEDs to provide a single row with multi-color instead of your current two rows (one red and one green).

Where:
   3 = Off
   2 = Red
   1 = Green
   0 = Yellow

It would require more driver chips if you want the option of all three colors.
« Last Edit: July 06, 2015, 06:26:29 am by MarkF »
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Need help with a Microcontroller beginners project.
« Reply #57 on: July 06, 2015, 07:01:37 am »
An option to use RGB LEDs to provide a single row with multi-color instead of your current two rows (one red and one green).

Where:
   3 = Off
   2 = Red
   1 = Green
   0 = Yellow

It would require more driver chips if you want the option of all three colors.

You can also get two-legged two-colour LEDs, which are simpler to layout and presumably cheaper.

Quote from: someone
But you can't show yellow with a two-legged red/green LED!!!!1

Oh, but yes you can: PWM rapidly between red and green and you'll get yellow.

Also, you can get red/green three legged LEDs. All I'm saying is, don't be buying blue LEDs you're not going to use! Unless, indeed, it's cheaper through the madness of supply and demand.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf