Robust and easy to implement serial bus (automotive application) [closed] - serial-port

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
What serial communication bus would you use in a automotive embedded system if your main selection criteria were:
Electrically robust
Slow speed (32 kb/s)
Easy to program
Easy to interface with microcontrollers
It won't be transferring much data, but it will need to be transferred periodically at high speed (100 - 500 Hz). I find that RS-232 is just not reliable enough if you have noise in your ground line. CAN-bus seems interesting, but I have no experience with it.
We are currently interested in a combination of AVR AT90CAN128 microcontrollers.

You've already chosen the AT90CAN128, whose standout feature compared to other AVR processors is support for the CAN bus. There really is not a better choice than CAN for an automotive application with your data rate and noise immunity requirements. If you march in to an automotive customer with anything other than CAN, you'll end up spending all your time defending the decision not to use it.
With that said, for noise immunity in a hostile environment like a car you'll need a bus using differential signaling. That rules out i2c or SPI, which is unfortunate because they meet your other requirements. RS-485 would be workable as #Andrew Edgecombe points out.
If you're not building a commercial product but instead building something for your own use to put in the engine compartment, you can probably get by with USB. USB will make it easy to interface with a laptop in the passenger compartment, and though it isn't designed for high-noise environments it is differentially signaled at a reasonably high voltage.

For all out reliability you can't go past CANbus (but then that was sort of implied by your choice of processor?)
Depending on what you want to interface to, this can be very simple - the base level protocol is quite straight forward. But if you want to talk to any other non-proprietary devices you'll have to implement the higher protocols (eg. CANopen).
But if CANbus isn't appropriate, then I would recommend RS485 or RS422 (depending on your topology). If all you're trying to achieve is point to point communications it's identical to RS232. (you'll have to put your own protocol layer on top if you're trying to support multidrop comms though.)

Two other excellent choices other than CAN are LIN and FlexRay. LIN is a simpler, slower interface while FlexRay is more robust and designed for safety critical systems like real-time controls of brakes.
For a nice overview chart of how the various bus choices interrelate see this slide.

I would always suggest that CAN is the best in automotive communication.
It has got differential line which can withstand even if there is a electrical glitch in the data transfer in physical layer
it can provide reliable speed, it serves 500KBaud rate speed in most of the automotive software applications.
interfacing is also easy if you know CAN controller mailbox and register structure.

As others said, CAN is standard, robust, more robust with slow speed etc.
And there's even support in Linux kernel for it from version 2.6.15 if you ever need bigger system.

Related

Arduino compatible chip wthout need of crystal for serial communication

I am asking this well ahead of applying it to get myself a chance to study content of answers.
Basically the question is if there is Arduino compatible chip (I am not interested in boards) which does not need external crystal to keep it in close enough sync to run serial (232) communication. To mine knowledge the atmegas builtin crystals are not very well calibrated. The speed of communication does not need to be high in fact I see no problem for less then 0.3kb per second.
I know its off topic, but best I have found was RTL8710 Roughly the the atmegas price, enough i/a with extra wifi as bonus. In case somebody is looking for answer

Energy effeciency factors for microcontrollers [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How microcontrollers can achieve high energy effeciency?
Is it by using time triggering, event triggering or using sleep time?
What other techniques can be applied to make them effecient?
Most modern microprocessors have several levels of low energy mode operation. These modes are very specific to the particular micro, but have in common turning off the clock or clocks used to run the chip. Turns out running a high speed clock consumes significant power. So the first level of energy savings is to turn off the high speed clock when there is no work to do. Many chips have other modes all the way down to cutting power to RAM (and loosing its contents) so that it can only be awakened with a reset. Again the specifics depend upon the microprocessor and those specifics need to be carefully considered in the overall system design.
Software plays a critical role in energy consumption. For battery powered devices, the way you save energy is to not run the micro and remain asleep as much as possible. So your software design should avoid periodically waking up just to poll something and discover that there is nothing to do so it can go back to sleep.The goal is to be strictly event driven even when it comes to time based activity. The object is to get in, get done what you need to do and get back to sleep. Such designs are often reactive in nature being triggered by happenings in the environment detected by hardware and signaled by interrupts.
Most modern microcomputers have an array of sophisticated peripherals that can do many system activities without involving the CPU itself. This is another system technique to reduce power consumption -- do it in hardware. It is almost always more power efficient to do things in hardware. So things like DMA, timer driven ADC and other techniques are also important to reducing system power consumption.
Many ultra-low power devices have a significant component of the system as custom hardware to reduce the amount of CPU time required run the functions of the system.

Home automation for software enginners using Arduino [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'd like to create my own smart home automation. Since I'm software engineer and don't had the opportunity to play with hardware, I think that this is a great time to play with some low-level stuff.
I've read a lot about hardware programming (I do work with C for software programming, in case of need and got basic knowledge in ASM) and I've understand that I should go with Arduino / Rassbery Pi since they're the most easiest hardware to start working with electronics.
I've started to use the Arduino starter kit and do know how to control LEDs etc. but now I'd like to communicate with the room electrics, air condition etc. and looking for some information about how to do that. Theoretically I'll wire a WIFI shield to the Arduino device and will create simple REST API. Then, I'll create an iOS and Android applications for communication with this API.
I'm looking for information in the electricity aspect:
- How can I wire the Arduino to the room light?
- Should I need an Arduino microcontroller for any electric input I'd like to control (and WIFI shield too? it won't make the price too high?)
I'd like to note that in case it's really complicated for a person who don't know much about electricity I don't mind to use any other hardware that can ease the process. My objective is just to be able to program a smart home.
Your questions are quite broad, but I'll try to answer you
How can I wire the Arduino to the room light?
You need to use either mosfet components or relays. The most easy one to use is the relay. Usually, you drive the relay with a simple BC337 NPN transistor. What does all that mean? It's all explained on that page.
But be careful, playing with electricity can be really dangerous.
If you want to make a light gradator, then things will become a bit more complicated, involving digitally controlled triacs, or digitally controlled potentiometer (for low current).
Should I need an Arduino microcontroller for any electric input I'd like to control (and WIFI shield too? it won't make the price too high?)
It depends, there's no absolute answer for that. You can wire your arduinos (or even use ATTiny, which are way cheaper) to each of your switches, or you can have one microcontroller per set of switch etc.. That's up to you to look at how your switches are organized in your place, and how you can design your system to better fit your needs.
The best option, imho, is taking control of "state switches" (you know the switches where when you push once, it's on, and twice it's off). On those you can control all your lights from your electric board, depending on the maker of your device, they can be controlled by 5V, 12V or 20V impulses. So one device on the electric board and you're all set. But those switches need a redesign of the light's circuit in your home...

Micro-Controllers Programming [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I bought an Inductance sensor that is used to detect cars for using it in my current Project, my question is: How do I program this sensor or interface with it to read data from it, what is the approach, which programming language should I use and how?
Check out Arduino, it is a good place to start, it is programmed in the C language.
Check out thier website: http://arduino.cc/
I reccommend you get a Microchip PIC microcontroller. Make sure that the PIC has an analogue input and digital output port. You can connect the sensor to the analog input. This input is convertered by the internal ADC and you can read this into your program.
Use the Microchip IDE for programming. You can either do this is Assembler or C. Assembler is a set of machine instructions and C is more high level.
Read this website: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=81&redirects=developmenttools
If we are all going to answer with, hey try this microcontroller I might as well throw in a few:
The msp430 has a very clean and simple instruction set, and good tools. at $4.30 you might as well buy the max 3 per order and just have them for a rainy day...
www.ti.com/launchpad
For about $20 you get everything you need in this one package:
http://www.st.com/internet/evalboard/product/252419.jsp
massively more powerful than the pic or avr for half the price of a normal entry level arduino.
There are a couple of pic32 (which is really a mips not the traditional pic instruction set) boards in the arduino price range.
I have and like arduinos and cut my teeth on pic's before moving on, dont get me wrong they are fine, have their pros and cons.
go to http://www.sparkfun.com to find tons of things, developer microcontroller boards, and perhaps interfaces to the sensor you are interested in, etc.
The real answer to your question is not what is my favorite microcontroller or board but how do I use this sensor. When or before purchasing you should have figured that out. You need to research how those sensors are used, what if any sensor specific hardware or circuits are needed, etc. You might find a turnkey package at sparkfun for example or some other arduino shield that just does everything you need. Or perhaps a different sensor type that performs the same function.
I am guessing you are going to need to sense current in some form or fashion, do some googling on inductance and inductors. You might want to put a small precision resistor in line with the inductor and measure voltage across it using an ADC in a microcontroller or a standalone adc hooked to a microcontroller or something else. Depends on the precision you need, you might need more than a microcontroller can provide. Which gets into how do I interface a spi or i2c ADC. You might want more than a small resistor to avoid melting down the sensor or circuit...
If you dont want this question to be closed and sent to electronics.stackexchange then you need to edit your question and provide a direct link to the sensor you purchased. If it is just an inductor then you have to add more circuitry if it is a full sensor package with a serial or parallel interface (spi, i2c, rs323) then that is a programming question but you still have to then decide on what microcontroller you want and ask how do I do i2c in an arduino for example (of which there are many web pages).

Creating a network adapter - how hard is it? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'm interested in building a little (commercial) device on top of Arduino. I want it to be able to interface with network. Network as in standard Ethernet, Cat5, RJ-45, etc.
I know that there is an Ethernet Shield, but it costs even more than the Arduino itself, and it's pretty big. Naturally, I want my device to be as small and as cheap as possible.
So I'm thinking about recreating an Ethernet module myself. The problem is - I haven't got any experience with Ethernet, nor do I have a good idea where to start looking. Thus I can't even say if my ideas are feasible.
Ultimately I would like the device to have three ports - one for incoming signal, two for outgoing, so the device is essentially a little switch where it is plugged in itself as well. The switching capabilities need not be very fast - the volume of data will be low. 10Mbit is more than enough, can be even slower.
If that is not possible, a single port for controlling the device itself will also do.
Another possibility I'm considering is power line communications - sending information through power lines. That's another area I've no experience with. What hardware should I be looking at, and where can I find information about the necessary software?
So - can anyone tell me if these ideas are feasible, and if yes - where should I start looking?
It's feasible, but you're going to need to delve deep into layer 2 of the network stack, especially if you want to build a tiny switch. If you steer clear of layer 3 you can avoid having to implement your own IP stack which would be a major pain.
I'd recommend starting with fully understanding how layer 2 works, from top to bottom. Once you've got a solid grasp of what's going on, especially with regards to the Ethernet spec, then you can worry about how you'd go about doing that on an Arduino. I don't have that much experience with the Arduino, but a buddy of mine implemented a layer 2 hardware stop-and-wait protocol on an FPGA a few weeks ago, so you should be able to get at least something rolling. you probably won't be able to go any faster than 10 Mbit unless you've got a pretty fast clock, though.
First of all I wouldn't think about the powserline technology is too complex, may be wi-fi can be possible, even though you have to deal with microwave frequency.
The best solution is as you said to find an Ethernet Shield, try to find an open hardware solution (drawing of the circuit). If you want to deal your own, you have to fnid a chip and threre are available, have a look on RS components. Probably most of the chips available are SMD, which means that is a pain to solder them, unless you are pretty clever and you have a microscope.
You can find a chip or a ready made solution here; http://www.beyondlogic.org/etherip/ip.htm
You could switch to Rabbit semiconductors, they have microcontroller ready with ethernet, but the dev kit is more expensive and the programming too.
This is a chip that you can use; http://www.wiznet.co.kr/en/pro02.php?&ss[2]=1&page=1&num=102

Resources