can you change code values on a MCU while its running - microcontroller

i want to run a MCU and be able to change values in the code while its running just to give an example i have a position sensor with a homing pulse the mcu is programed to only send a trigger pulse out 10 pulses before the homing pulse but i want to be able to adjust that (on the fly) so to speak so as the machine is running adjust it till its perfect so almost like an offset i thought of using a dual bank memory MCU and i just also want to find out if anybody has any experience with dual bank memory MCUs and are there maybe any MCUs that support such a function as live code adjustment or if there is just a simpler way im not seeing here
i am very new here and i dont have a lot of experience with this sort of stuff
any help would be really great thanks

These are quite a lot questions in one and not all is fully clear to me.
Regarding the MCU:
I'm using ESP32 primarily, which is cheap and supports bluetooth and wifi.
Regarding the question of "on-the-fly" adjustment, I see at least three different options with increasing complexity and knowledge required:
Use an I/O port that can implement an A/D converter. With a potentiometer you can than fine tune the clocking.
Implementing a web server with wifi on the MCU: this way you can use your phone's web-browser to send configuration information.
Use OTA (Over The Air) to flash the controller with new data and possibly new instruction set.
You can find many good tutorials using the ESP32 or Arduino-family on youtube.

Related

Recieve BLE info and pass along information through UART on TI CC2640R2F

I have been looking at TI's training material for 4 days and feel like I'm getting no where. I think this should be a pretty basic task but don't even know where to start.
I need to receive a Bluetooth Low Energy packet from a Android device that will have information on 24bit Color and which LED to change. I need to pass this information through a UART port to a MSP432, as well as have a UART port that controls the CC2640R2F. I have looked through most of TI's examples and it seems there Network Processor example is closest to what I need. If someone has an example project of something similar to this or knows where to find one that explains what is going on I would be very grateful.

Can I use a RaspberryPi OR other device for all my inputs remotely

Can I use a RaspberryPi OR other device for all my inputs remotely and then send that data to be used in a calculation on a desktop and then send an answer back to the raspberry pi?
This is an idea for my prject.
This is a bit difficult to answer without a lot more detail, such as the sensors you are using and what you are looking to do with the data. I'm guessing you are reading a sensor using GPIO pins, doing a calculation on another computer, and then doing something with whatever is calculated on the RPi again?
The short answer is you probably can, but remember that the Raspberry Pi is very capable and you may be able to do the computation on your data locally on the Pi itself. If you are processing the data with python or uploading it to a server you should be able to do that all from the Pi.
If you truly need to do something with the data on a separate system, I would look into using an Arduino microcontroller of some sorts instead. A wifi-enabled build (such as the popular ESP-8266 variants) will be able to quickly read sensor data without the overhead of running a full OS, while still being able to transmit wireless to your computer. There are also countless resources and tutorials for doing so that you can access to help there.
If you are set on using the Pi, or are just more comfortable using it, then there are tons or resources for how to transit data from your sensors including plenty of Stack Overflow questions such as this one

Is it possible to program an Arduino from another embedded device?

I am currently working on a system (home projects - finally got the time yay!) and i am wondering whether it would be possible to program an arduino from a pic32? the system currently has both and given the pic32 proc has an SD card attached, i figured i could use the platform potentially to program all the other systems if there was new firmware deployed onto the SD card..
just wondered if it was possible? there doesnt seem to be anything online but maybe im googling the wrong thing? i suppose the pic32 would be acting as an ISP?
Thanks in advance..
Chris
sure, why not, it is just spi. I think just out of convenience (of something with spi on it or trivial to bit bang) I use another microcontroller to program my avr (an msp430 or mbed which program easily over usb). avrs docs are pretty good on the protocol. you can use the serial bootloader as well, but that gets into a larger number of combinations of which arduino, what speed the uart is, exactly how and you have to tickle the dtr (reset), seemed like when I was still messing with that each arduino board type was different. Where with the isp interface excluding xmega, there are chip to chip differences as far as the identification number, etc but easier come up with something more generic. And the nice thing about that spi interface is the processor is in reset so you are not relying on there being a bootloader, what version of the bootloader, or a chip with a flash that is for some reason causing a hang, etc. you should generally get the same programming experience independent as to what was programmed before.

How to program an XBee ZigBee module?

I have a project which the information from the microcontroller (drop rate changes of dextrose like sending notification "nearly empty" or "Sudden change of drop rate. Drop rate of 15 automatically return to 14") would display in an application in a computer. I am thinking of using ZigBee and it would be responsible for transferring the information but I am new with the technology.
Does anyone could help me how to program the ZigBee module? I have seen some articles saying that it could be programmed in eclipse CDT. I am bit confused how to get start.
Any help would be appreciated. Thanks!
Use USB Explorer device (or similar) to enter a serial terminal session on the receiving XBee.
Type ATMY to get the receiving XBee's address. Write it down.
Put the sender in the USB Explorer and type ATDL plus the receiver's address, like "ATDL798A728"
Type ATWR to save this setting.
Attach sender XBee's UART (TX and RX pins) to microcontroller.
Plug receiving XBee into USB Explorer attached to computer.
Run Processing sketch or similar to read from the serial port.
The two XBees will run by default in 'transparent mode,' which pipes data coming into one UART out of the other UART, exactly like a wire. So when your microcontroller writes data into the sender XBee, it will come out of the receiving XBee and be read (and displayed or whatever you need) by your software.
It really depends on how much configuration your installation can handle. Is this a one off installation, or a "system" of products you want to make that have to be able to work together in whatever configuration they're bought?
As already explained, xbee modules that have the whole radio + stack already setup and working for serial data are simple to use for the trivial case of you sending out a few pre-paired setups form the lab, or even site installation by an expert.
If your embedded devices have to find each other automatically, then you'd need a way to get the embedded microcontroller to get the modules discover each other, make a connection, and then have the application code in the embedded microcontrollers talk to each other and identify what they need to do with each other.
In this case, you probably would be better off with the (upfront much more complex and likely expensive) design where the zigbee stack is inside the embedded controller, so your application code can use it properly to control connectivity.
The TI zigbee pro evaluation kit is very comprehensive, and seems great to me so far. It sounds like you're at the point where you need to spend some money and get some experience with real modules, just to get a feel for the technology. Though be warned, you may need IAR embedded workbench to work with these long term, and that's pretty expensive software!
Alternatively, Atmel have a pretty interesting looking zigbee implementation with their "bitcloud" software platform (free zigbee pro stack!! woo! and they have a free ARM toolchain!) but I've found the getting started info around the bitcloud stuff is really lacking, and while I can get the code setup and compiling, I'm not confident to buy enough of their evaluation gear for a zigbee pro mesh network to test it in real life yet.
PS: if you're getting started with short range wireless, i can't recommend this book highly enough. http://www.amazon.com/Essentials-Short-Range-Wireless-Cambridge-Series/dp/0521760690/ref=sr_1_2?ie=UTF8&qid=1336091059&sr=8-2
It contains very good introduction to the different technologies available, and the strengths and weaknesses of all of them (and wireless in general) Plus it will leave you in a good position to start understanding the features you really need for the system you're designing.
some of the zigbee/xbee modules simply behave as wireless serial, no programming required just turn them on. Others require programming. It depends on what your needs really are. the ones that behave like wireless serial have an AT command set if I remember right so you can adjust some things, like for example if you want more than two (more than one wireless point to point connection) you can specify which two talk to each other...

What is the difference between a Relay Controller and a Microcontroller?

What is the difference between a Relay Controller and a Microcontroller?
I'm looking into Arduino boards and am just getting into electronics, so I wanted to know the difference.
I know this is not a programming question, but I am developing in PHP and would like to know what the difference is before I start to code to make sure I'm going down the right path.
Those two devices are very different. Depending on exactly what you're trying to do, you may be able to use either, however. You'll have to tell more about your goal.
If you're switching high-current or high-voltage loads on and off, you'll need some sort of relay (or perhaps a large FET). If your current and voltage requirements are sufficiently low (5V, 40ma), you may be able to drive your load directly with the Arduino's output pins.
The Arduino is a microcontroller. That means it's an entire computer, just simplified. It has RAM, registers, an ALU, etc. Microcontrollers are generally specialized such that instead of interfacing to peripherals using some kind of bus like in a desktop computer processor, they have I/O capabilities built in, often simply in the form of outputs that can be set high (the input voltage, usually 5V) or low (0V) programmatically. The Arduino probably uses its own programming langauge, although there may be more than one language available for it (I've never used one). I doubt PHP is one of those langauges.
The relay controller is exactly what the name implies -- a simple circuit that controls some relays. Relays are electrically actuated switches. There's no intelligence in the relay controller. It can't be programmed; it must be controlled externally via USB. If you're attempting to interface with it from PHP on a desktop/server computer, this is probably your best choice. You're right that it's expensive. You could probably build your own for a fraction of the cost, especially if you're willing to use the parallel port on your computer (googling for how should give simple instructions). It's worth noting that that relay controller, and presumably most others, likely contain some kind of microcontroller with the I/O pins connected to circuitry that increases the current and/or voltage to the point where it can drive the relay, which in turn switches the load.
Hmm... only very vaguely programming related :) I think we may need another StackOverflow for electronics. Maybe SparkOverflow?

Resources