Science topic

Microcontroller Programming - Science topic

Explore the latest questions and answers in Microcontroller Programming, and find Microcontroller Programming experts.
Questions related to Microcontroller Programming
  • asked a question related to Microcontroller Programming
Question
3 answers
I have a doubt regarding wavelet transform.
If we have power constraints while making an algorithm , is it advisable to go with time domain features, or frequency domain features.
Will Wavelet based feature extraction and processing consume more power when incorporated in a Micro Controller Unit?
Or does it depend on the type of wavelet used?
Thank You and Regards
Relevant answer
Answer
The power requirement of wavelet transform is usually higher than both the time and frequency domain features. This is because the Wavelet Transform provides a more detailed picture of the data compared to the other two methods. For example, the Wavelet Transform can provide detailed information about the frequency components of the signal over different time intervals, which cannot be obtained from the other two methods. It can also provide information about the local variations in the signal, which is not available from the time or frequency domain features.
  • asked a question related to Microcontroller Programming
Question
1 answer
Can anyone provide me with an Arduino code to read the Razor IMU which is connected with Mega 2560?
Relevant answer
Answer
Here you can find the download information for the Razor IMU, it seems to be compatible with Mega as well:
Hope this works
  • asked a question related to Microcontroller Programming
Question
6 answers
How to reboot/reset ESP32 without pressing the reboot button on the board. I'm using platformio VScode IDE. Is there a way I can do that using the IDE without touching the board?
Relevant answer
Answer
Connect any GPIO port to the RST pin.
Initiate that GPIO port as output and set it to HIGH at boot.
When you need a reset, switch the GPIO port to LOW.
  • asked a question related to Microcontroller Programming
Question
3 answers
I have had great success with Tasmota firmware on a dozen Sonoff basic devices and a couple of TH16s.
I'm looking to go deeper and if possible create code for a chlorine level capacitive level detector.
Using a concept I have used in the past, with a 32 bit 8 core microcontroller, of applying a voltage momentarily to a capacitor to an output Pin, while simultaneously starting a counter, switching that pin from output to input, then when the voltage on that same pin falls to 1/2 VCC the counter stops and that count value is compared. The 1/2 VCC threshold was simply when the state of the now input pin transitioned from on to off.
I'd like to do a similar thing using the ESP 8266 with a couple of large plates on the outside of a plastic chlorine tank and determine the approximate level based on how long it takes to charge this crude capacitor which should vary via tank level.
I'm not looking for super high accuracy like +/- .1" but something +/- .5" would be sufficient.
While I am quite adept at programming in Assembly, my C skills are standard & basic in python.
I'd like to make this part of my Node Red Home Automation system running on a Raspberry Pi so as to monitor the tank's chlorine level via my cell phone.
Anyone use the ESP8266 for this or similar purpose? Ideally I'd like to use a Sonoff Basic as it has the power supply and is self contained. I'd obviously have to add some external leads to the tank's capacitor plates.
Relevant answer
Answer
Mohamed-Mourad Lafifi Thanks a lot for helping me & taking forward to my research!
  • asked a question related to Microcontroller Programming
Question
7 answers
Well there are different boards around.
1st. I see CH340 USB chipset on these photos. (Can’t find the source) but I read that this one are fakes/not official and have different layout like mention before. There are some with a CP210X around, as well, but mostly with same size, layout and pinout (Can’t prove if I’m right/wrong).
2nd. If you want to buy the ESP32, inside of the official Datasheet there are already 6 different boards mentioned. Some with single core instead of dual core. However, they are even with 34 to 40 pinout if you buy something like Node MCU, Wroom, ect.
3rd. Almost every company/producer do updates on they boards. (Especially boards for Arduino). Sometimes they write “Rev. X” or similar.
As you can see, there are many kinds of layout around which can do the same things but with one or two different. Most of the user here won’t even notice this until they need something which isn’t available.
Relevant answer
Answer
As far as I understand for the blog post. After reading your 3 mentions "Blog Post" I should follow Agile for beginning the project.
  • asked a question related to Microcontroller Programming
Question
6 answers
I need my ESP8266 to be an access point and command multiplexer to more devices. I need at 5 to 7 devices - 4 to 6 slaves and one master that sends them commands by TCP/IP and receives responses. I can't broadcast UDP, and commands must be sent to all nodes in less than 250ms.
The issue is that by default ESP8266 doesn't allow more than 4 connections. There are a compile-time variable max_connections set to 4. Some say that this limit can be set to 8, but ESP8266 won't support more sockets than 5. I'm here to ask: is there any way to surpass that limit? I have three possibilities on how to do that:
  1. Somehow configure ESP8266 that it can support more connections - perhaps it's just a question of reserved resources? Maybe somewhere in the firmware, there is another limit that can be changed? Disconnect one socket and connect another device in its place - will this be reliable?
  2. Use something else - but what? I need something small and fairly cheap. Other platforms I considered:
  • Arduino YUN - too big and quite expensive, unsure about the limit of clients
  • CC3000 - doesn't support AP mode
  • Onion Omega - unavailable and unsure about the limit of clients
  • Raspberry PI 3 - too expensive and too big
  • Raspberry PI Zero + WiFi dongle - PI Zero is unavailable below 10x it's official price
  • Intel Edison - verified it works, but is very expensive
  • Sparkfun Particle P0/P1 - not sure if AP mode is controllable and what is the limit of clients
I could do with a very small embedded router and an ESP8266 to control it - but can't find any such part either.
3. There is also one solution that I really don't want to do, but have considered it - stacking ESP's - I can do that, but this will be a very big hack and will make large problems with connecting devices to this monstrosity - must make more than one wifi network, will have to keep track how many devices are connected to each network etc.
Could you please tell me if #1 is possible? If not, any recommendations on #2?
Relevant answer
Answer
I didn't check in detail, but the limitation might stem from limitations in memory (RAM): the "mature" network stacks/protocols haven't exactly been designed with low resource consumption in mind.
Thus you may consider to use an ESP32: basically an ESP8266 "on steroids", it sports a dual-core microcontroller and significantly more memory at about the sme price.
  • asked a question related to Microcontroller Programming
Question
8 answers
Hello Every one,
I am trying to communicate my PSOC microcontroller chip 5LP (LP035) with Raspberry Pi. I have written Pi program in C and java(in order to check the speed of communication between two languages)
PSOC(microcontroller) is acting as slave and Pi is a Master.
Between the communication I set up a mask that is responsible for giving back the required channel value to the master (Pi).
My code was working properly but now it start behaving different (I have not change any thing!) .
Firstly, It only works correct when master send a mask value either 1 or 3.
Secondly: If my program is working (communicating) properly with Pi (java programed) and if I run the same program with Pi (C programmed) and vise versa. I start getting garbage values and sometimes correct value along with garbage value.
I dont understand where the problem is laying.
I will be very thankful to you If any body can help me in it!
Looking forward to hearing from you!
Regards
Relevant answer
Answer
Hi Muhammad, there can be a few issues which cause garbage with serial communications. Generally, timing is everything, having too many statements and loops in the data collection part of your program can cause errors reading the SPI buffer as the statements take too long to process and the SPI register has moved on! (This can vary with the compliation options you set when writing the code!) Making sure the MC is has the correct oscillating frequency and adjusting the OSCAL variable if it is off can also help. Also check there is a clean switching between receiving and sending data, in many cases it can take some time for the MC or supplementary interface chip to switch between receive and transmit, and this can cause the data to be corrupted.
  • asked a question related to Microcontroller Programming
Question
9 answers
Working via Matlab and Arduino with using the serial port from arduino to Host computer ?
Relevant answer
Answer
Dear Qasim Al Azze
Firstly, during programming, you cannot receive or transmit any data on serial port as the program written for transmitting and receiving the data is being updating (i.e. old program erasing and new program writing) in the flash and  arduino is in programming mode and not in execution mode. Moreover no data can be input or output on any of the supervisor pin.
However, the connection and removing of peripheral connected to serial port is only during testing phase. Once the program is finalized, the removal of peripheral connected to serial port is not required.
However, if you require to dedicate one available serial port for programming, then you can use a library named "SoftwareSerial" from Arduino to get serial port type feature on any GPIO port.
Hope this might assist you in your query.
  • asked a question related to Microcontroller Programming
Question
10 answers
Wearable devices typically need a compact operating system to fit into low-power microcontrollers.
Relevant answer
Answer
thanks @U. Dreher for your answer.
  • asked a question related to Microcontroller Programming
Question
3 answers
I have a question regarding Pentium 68000/2732/6821 based micro-controller design,
What would be the input and output (I/O) and memory map of the bottom of the schematic shown?
Here would be the schematic for the example, could anyone give me advice to understand how the schematic works?
Any help or comments would be appreciated.
Relevant answer
Answer
  1. 68000 is a microprocessor from Motorola (now Freescale).See https://en.wikipedia.org/wiki/Motorola_68000
  2. 2732 are 4 KBytes EPROMs (several vendors)
  3. 6821 was from Motorola too - a so-called Peripheral Interface Adapter (Datasheet: http://sowerbutts.com/replica1-serial/6821.pdf)
Regarding the memory map: follow the address lines A1..A13 and see what happens especially with A13. (A0 is not available. It is already expressed as /UDS resp. /LDS that are read as Upper resp. Lower Data Strobe.
Neither 'Pentium' nor ARM - the processor is from the era of the Intel 8086.
Hope this helps
  • asked a question related to Microcontroller Programming
Question
5 answers
With older data sheets of microcontrollers were having such fabrication information.  From last some years it is not seen.  From designing & interfacing prospective we are following old standard pull-ups / pull-downs.  Does with technologies there are changes? For example, for I2C interfacing 10K pull-up are standard values.  For low power & reduced MCU voltages & open drain cases it is observed that even 47K pull-up also works well.  Can we use 1M registers as pull-up & in open drain cases?
Relevant answer
Answer
There is a 'practical' limit: resistors beyond 470 k are critical as parasitic resistances (eg. caused by humidity plus flux residue) can easily be in the same order of magnitude.
If you want to maximize battery life, you may want to think about switching off the power supply of parts of your nets when not required. This could include I2C slaves and the pullups. Or to eg. reduce traffic on I2C :)
Just an example: reading temperature sensors faster than every 100 ms normally does not make any sense as hardly any temperature sensor does change its output that fast. (Most t-sensors are more in the multi-second response time.)
  • asked a question related to Microcontroller Programming
Question
8 answers
C programming language
Relevant answer
Answer
I would recommend you to buy an ARM toolkit. (LPC1768 and LPC1788 from NXP are both appropriate microcontrollers to start programming). just a book without any real world material can't give you enough insight into the programming concepts of a microcontroller. I think digging into the technical user forums on the net and reading and programming available programs shipped with the tool-kits is the best way to learn.
  • asked a question related to Microcontroller Programming
Question
4 answers
i am working on dv-hop localization algorithm. i have implemented the protocol in ns2 but when m running its tcl script, it shows error if any one have error free dv-hop tcl script then please give it.  it will be great help for my research or else if any one can solve this error i will be thankful, error is: (num_nodes is set 9 (_o15 cmd line 1) invoked from within "_o15 cmd addr" invoked from within "catch "$self cmd $args" ret" invoked from within "if [catch "$self cmd $args" ret] { set cls [$self info class] global errorInfo set savedInfo $errorInfo error "error when calling class $cls: $args" $..." (procedure "_o15" line 2) (SplitObject unknown line 2) invoked from within "_o15 addr" ("eval" body line 1) invoked from within "eval $node addr $args" ("default" arm line 2) invoked from within "switch -exact $routingAgent_ { DSDV { set ragent [$self create-dsdv-agent $node] } DSR { $self at 0.0 "$node start-dsr" } AODV { set ragent [$self cre..." (procedure "_o3" line 14) (Simulator create-wireless-node line 14) invoked from within "_o3 create-wireless-node" ("eval" body line 1) invoked from within "eval $self create-wireless-node $args" (procedure "_o3" line 23) (Simulator node line 23) invoked from within "$ns node" ("for" body line 2) invoked from within "for {set i 0} {$i < $val(nn) } { incr i } { set mnode_($i) [$ns node] $mnode_($i) random-motion 0 } " (file "/home/mahnoor/Downloads/dvhop2d/dvhop_802_11.tcl" line 47)
i have attached the code. Please reply soon.
Thanks
Relevant answer
Answer
thanks for your response but it was not so there were many bugs
i tried it for 9 t0 10 times and finaly i done it i will post the bugs and solutions soon
  • asked a question related to Microcontroller Programming
Question
4 answers
What is the maximal sample rate for mpu6050? 1KHZ or?
Relevant answer
Answer
According to the datasheet (see 1st attachment) the maximum update rate is 8kHz. Setting the update rate is done by writing to the correct register (see 2nd attachment)
  • asked a question related to Microcontroller Programming
Question
2 answers
For a research I need to use 3 Proximity sensors at the tool tip of 3DoF RRR robot arm, aligned to (X3,Y3,Z3) frame. How to convert these sensor readings w.r.t base frame coordinates (X,Y,Z)? What about Eular angles method? 
Relevant answer
Answer
Dear Dr. Mohan Chandra , thanks lot for the valuable information.
  • asked a question related to Microcontroller Programming
Question
3 answers
I have LCD (from top way display model LM6059BCW) and i want to use it with microcontroller PIC16F877a. How can I redefined on MicroC software library?
Relevant answer
Answer
LM6059BCW based on ST7565P LCD-controller. On MicroC include ported-version of open-cource GLCD-library with low-level driver only one for Samsung KS108/KS107 LCD-controller. ST7565P and KS108/KS10 are not compatible. See https://www.mikroe.com/forum/viewtopic.php?f=72&t=56735  
You can use vanilla GLCD-library and self-port driver code for ST7565P by example for KS108/107 from MicroE --> http://www.mikroe.com/download/eng/documents/compilers/mikroc/pro/pic/help/graphic_lcd_library.htm
  • asked a question related to Microcontroller Programming
Question
8 answers
Best Trainer for PIC18F series.
Relevant answer
Answer
Hello Ghulam Abbas,
While choosing a particular starter/trainer kit these questions would help you to decide which particular kit/board suits your exact needs.
1) You are starting from scratch to learn microcontrollers?
=> If your answer to this is "NO" then go to step 2 else -
There is one Starter Kit DM180021 that hosts PIC18F46J50 device and has microSD Card, USP, graphical display and a bunch of USB library to support from the Microchip USB Framework.
This particular board comes with a boot loader so no external programmer is needed and you can explore the features of that particular microcontroller chip.
BUT if this is not you intend to do which I am sure will want to explore more on hardware interfacing to your own hardware or unless you do not want to build your own hardware then certainly, this board is not meant for you.
2) Do you have previous experience with any of the Microchip microcontrollers?
If the answer to this is "NO" refer step 1 again.
If however the answer is "YES" then pay attention to your present and future needs.
3) Can this starter kit or board fulfill your all requirements?
4) Are you present development tools such are programmers capable of programming the PIC18 family of devices?
If you have some programmers like PICKit2- or the latest PICKit-3 or any of the ICDs, you better start with the daughter boards for a PIC18 device more suitable to your needs.
Sometimes starting with more popular DIP versions si easier during the development phase and once you have freezed your design go for the SMD versions. Or you can use the plug-in-modules to interface with your hardware setup.
My personal suggestion would be if you have previous experience with (PIC) Micros, you need not go for any starter kit. If you are worried about SMD soldering then you can take help of plug-in boards but that is not recommended.
Just provide the ICSP connections to any board you make with a particular PIC18 device that should work perfectly for your needs. Microchip maintains 100% pin compatibility to most of its 8-bit devices and you should have no problem with playing around PIC16 and PIC18 family devices on the same board.
I have made a generic board for myself and keep on working with PIC16F as well as PIC18F with USB connectivity on the same design. All port connections are brought out on external pin-headers. Photos attached! Therefore I would like to encourage you to make one for yourself or if you are willing to share your requirements I can help you make a board to suit your needs.
Thanks and Best Wishes!
-PRASANNA WAICHAL
  • asked a question related to Microcontroller Programming
Question
3 answers
I want to use CSNE151 current sensor in my control loop. Output of this device goes to the microprocessor then i have to decrease this output to 3 volt. i can't find suitable circuit model to apply it. In addition i want to know how can i adjust output of current sensor in my desired level?
Relevant answer
Answer
I did use a current sensor for my project last 8 years.. The most important thing you should allow the maximum voltage (converted) to half of your adc maximum input voltage.. Another thing to be considered is the level shifting... But some microcontroller can accept negative input such Vref+ = 3.3V and Vref- = -3.3V.. Selection of the microcontroller is another part in your project... All the best
  • asked a question related to Microcontroller Programming
Question
3 answers
Hi,
I just want to broadcast a message to a number of nodes, using Contiki socket.
Relevant answer
Answer
Hi I Putu Susila,
I just want to know whether contiki can be real-time. do you have an idea regarding this case?
thank you
  • asked a question related to Microcontroller Programming
Question
5 answers
Of course, there is CORDIC for sin() and cos(), and one could also use precomputed lookup tables for single variable functions like exp() and log(). However, common bivariate functions as pow(a,b) and atan2(a,b) seems to be a little trickier to implement.
I'm considering a simple RISC-like microcontroller such as the AVR. It can perform fast adds and shitfs and loads but it has no built-in multiplier hardware.
Relevant answer
Answer
Mr. Senzio
Actually I'm looking for some bit manipulation hacks for implementing these kind of functions on very low-profile or older embedded systems.
I'm attaching a link for this comment that will show to you an example of what I was thinking of.
Best Regards.
  • asked a question related to Microcontroller Programming
Question
2 answers
I just figured out to transfer data in my project is using synchronous communication. But, i need to change data to frame. FYI my project is to transfer image from OV7670  (camera module) to PC using RS-232. Thank's :)
Relevant answer
Answer
Hi,
generaly there are a two methods, how to make a comunication packet from data stream. First method is by using text packets. Text packets can include special chars for packet start (optional) and for packed end (usually Enter). But packet like this can not contain a general data (usually only visible characters from ASCII). General data has to be converted to text (using HEX or DEC representation, for example). This method is great for small packets, it offers great potential for debuging.
Better method for You is to use a general data packet. I don't know, how big are Your pictures, but text representation of the picture can double the size of picture. And RS232 is not so fast.
You can use one of the standard binary protocols, but my recomendation is to create Your own protocol. Your new protocol should designed using this rules:
1, You have to define a minimal time pause in between packets which is longer, than maximal delay between any two bytes in packet
2, every packet shoud begin with header - fixed sequence of bytes, which You can simple recognise in receiver
3, optionaly You can send the number of data bytes
4, then You can send the data
5, at the end of data I recomend to add some type of checksum.
Receiver waits for start of transmission. If there is a delay between bytes longer than minimal value, receiver just has to clear buffer and waits for the new start. After the header is receved, receiver check the header and if it is OK, then waits for data.
End of packet is detected using minimal delay between bytes or using known packet size (which can be included in packet itself). If the whole packet is in buffer, then You just check the checksum and if it si OK, You are done.
This method I used for design of several protocols and it works good. I also recomend to imlpement some mechanism to ensure, that packet in the receiver is OK. You can send a special OK packet (for example) from receiver to transmitter and repeat the transmission when a timeout occurs.
But if it is possible, consider to use other bus. I think that for example Ethernet is better for Your case.
  • asked a question related to Microcontroller Programming
Question
7 answers
a snap dragon arm 7 micro controller clocked at 1Ghz  has better performance then that of a mediatek arm 7 micro controller clocked at 1Ghz,what is the cause of performance difference??? is it something in the fabrication process,doping,or any other reason,please provide your valuable information .................
Relevant answer
Answer
As the other people said performance does not only depends on operational frequency. There are many metrics to compare the performance of systems that you can find some simple metrics in first chapter of Computer Organization and Design book.
for example in this book CPU execution time is introduced as one of the methods to compare the performance of different processors which is equal to :
CPU time = Instruction_number x Clock_per_instruction x
1/ clock_frequency
In this equation you can see at least two more factors are considered which depends on the ISA and architecture design. In summary 
CPU time: is the total your processor is busy for running a program.
Instruction_number: is the number of instructions in your program.
Clock_per_instruction: is the number of needed clock cycle to execute each instructions which is probably different for different classes of instructions.
Clock_frequency: is the parameters you have mentioned as operational frequency
However, these days the researcher announce more complex metrics like energy or energy x time metrics. as you can easily guess energy can be extracted by multiplying the power consumption of your architecture by its CPU execution time. 
  • asked a question related to Microcontroller Programming
Question
5 answers
I've put the LCD initialization code in CodeVision in different parts of the initialization segment of the program and it only works in certain places , one of which is where the Wizard uses as default.
Is there any explanation why such sequence occurs, or how to put the initializer code for any part in the right place without checking the Wizard?
Relevant answer
Answer
Yes, in one of my application if i initialise timer2 after timer0 it interrupt does not work. My code is right. Company people will not tell you this thing. I have even found fault in microchip devices datasheet
  • asked a question related to Microcontroller Programming
Question
10 answers
I am looking for ideas concerning a microcontroller mini project that must include analog inputs. I would prefer a not-so-basic project if possible. Any help is much appreciated.
Relevant answer
Answer
  • asked a question related to Microcontroller Programming
Question
2 answers
Hi all,
I want to know exactly what happens in the hardware when HLT command (Halt) is executed in a micro-processor or micro-controller. I have read that it functions in power-saving mode. Could any please help me explaining the exact working of HLT command and the hardware functioning on execution of this.
Regards,
Raghu
Relevant answer
Answer
The Halt instruction freezes the value of Program Counter. Since Program Counter is not getting updated and keeps its value as its is, fetching of any instruction is not possible. This will keep microprocessor in steady position. Clock is internally active but not connected to the Program Counter. 
  • asked a question related to Microcontroller Programming
Question
2 answers
OFDM stands for Orthogonal Frequency Division Multiplexing. Seeking to know if it is possible to implement it in microcontroller and how?
Relevant answer
Answer
Hi
As u you know OFDM modulatoin is implemented using IFFT which is no more than a mathematical operation. Basically try to find a microcontroller (with the adequate H.W.) capable of performing such a task. I would suggest using one from the PIC32 family.
The IFFT part should follow as u call the math functions (especially if u use C or mikroC)
  • asked a question related to Microcontroller Programming
Question
6 answers
I want to control the speed of DC motor via PID by using a microcontroller or a DSP
what's the best PID equation to perform such job?
Relevant answer
Answer
Dear Hesham,
I have made a diagram giving some more info.
  • asked a question related to Microcontroller Programming
Question
1 answer
I want to use an arduino uno +ethernet shield to monitor a surveillance camera in a remote location, create a database for the camera and light an LED at the CO (central office) to indicate fault, when factors to be monitored like power, voltage, operating temperature exceed the database created.
Relevant answer
Answer
Dear Ayodeji 
It will depend on how far the remote location is, that is the distance from the Camera. Is the camera a webcam, like a USB type or does it have an ethernet connection ?
Gerro
  • asked a question related to Microcontroller Programming
Question
13 answers
I was thinking about a low-cost gamma spectroscopy system which will be using a CsI(Tl) coupled to a photodiode as a detector and an arduino microcontroller instead of a MCA for the signal processing.
In your opinion, is it possible to emerge a decent spectrum out of the noise with this system?
Thank you in advance for your answers!
Relevant answer
Answer
Well, yes, but you will essentially be building your own MCA. You'll need to amplify and Gaussian-shape the pulses from your photodiode, then use a peak detect & hold circuit followed by an ADC triggered by the peak detector. Your Arduino can then bin the pulse heights into a histogram. If you have high activity source you will need to do something about pulse pileup (overlapping shaped pulses looking like one big pulse, which will distort your spectrum). From memory Atmel microcontrollers usually have internal 8 or 10 bit ADCs built in, so you won't get an incredibly high resolution, but should be enough for basic spectroscopy with a scintillator.
The spectroscopic amplifier is where you need to be really careful to minimise noise in your design. Your shaping time needs to be carefully chosen to match the detector's capacitance (there are lots of papers which talk about this, including application notes from various detector and instrumentation vendors) in order to minimise noise. Spieler's lecture covers this pretty well (look in particular around page 40):
  • asked a question related to Microcontroller Programming
Question
1 answer
I am trying to implement LEDs dimming using the GPRS shield V2.0 and arduino uno when i am outside of Bluetooth range, by sending commands via text/sms with each text setting the bulb to the appropriate brightness level. I am really stuck here and need some help on how i can do this and build a working circuit that dims LEDs using sms commands via the GPRS shield. Any help would greatly be appreciated!!
Relevant answer
Hi,
  You'll have to read the mensangem as String and then process this string to define what to do then. Take a look at http://www.seeedstudio.com/wiki/GPRS_Shield_V2.0. there you will find how to do this...here it is some example:
Fun with AT Commands
Step 0: Basic tutorial
AT+SGPIO=OPERATION, GPIO#, FUNCTION, LEVEL
OPERATION
0 = Set GPIO to output or keypad
1 = Read GPIO level (Funtion MUST be set to input ( 0 )
GPIO# SET to the GPIO pin number for the command 1=12
FUNCTION
0 = Set GPIO to INPUT
1 = Set GPIO to OUTPUT
2 = Set GPIO to KEYPAD
LEVEL
0 = Set GPIO to LOW 1 = Set GPIO to HIGH
Example: To set level of GPIO pin 3 HIGH (on);
AT+SGPIO=0,3,1,1
Delete all SMS messages in memory;
YourSerialName.println("AT+CMGD=1,4\r");
Read a SMS in index # 1;
YourSerialName.println("AT+CMGR=2\r");
Read list of SMS messages in memory;
YourSerialName.println("AT+CMGL=\""ALL\"');
Send a SMS message with text in a variable called newMsg;
YourSerialName.print("AT+CMGF=1\r");
delay(500);
YourSerialName.println("AT+CMGS=\"+17065551212\"");
delay(1500);
YourSerialName.println(newMsg);
or
YourSerialName.println("Hello World");
delay(100);
GPRS.println((char)26); // End AT command with a ^Z, ASCII code 26
Hope this is helpful to others who are enjoying this shield.
  • asked a question related to Microcontroller Programming
Question
4 answers
I am doing an MPPT algorithm. I face the problem of analog input in my dsPIC30F4011 microcontroller.program is run sucessfully in softwariy (mikroC PRO) but hardwarely output are not come,
Programming for to read analog input LED Blinking in port E AND F ---->
unsigned int temp_res;
void main(){
TRISE = 0x0000; //Port E is output (for ADC results)
TRISF =0x0000;
ADCHS = 0x0002; //Connect RB10 on AN10 as CH0 input
ADCSSL = 0; //No scan
ADPCFG = 0xFFFB; //RB2 ANALOG INPUT
ADCON1 = 0x0000;
ADCON2 = 0x0000; //Sample time ends with timer 3 clock
ADCON3 = 0x0002; //TAD = internalTCY
ADCON1bits.ADON = 1; //ADC on
while(1)
{
ADCON1bits.SAMP = 1; //ASAM=1, start sampling after conversion ends
Delay_ms(100);
ADCON1bits.SAMP = 0;
while(!ADCON1bits.DONE);
temp_res = ADCBUF0;
ADCON1bits.DONE =0;
TRISE = temp_res ; //Output result on port E
TRISF =(temp_res>>8); //Port F is output (for ADC results)
}
}
Relevant answer
Answer
Hello Priya, I agree with Juan Antonio Arizaga Silva. You should provide more information. However the reason could be that pin AN2 is not configured as A/D input. See ADPCFG and TRIS registers (or if you do not use assembler then the corresponding functions ). A good start for you is to read the technical documentation about this IC. It is available on Microchip web-page free for download (just google-it).
  • asked a question related to Microcontroller Programming
Question
5 answers
I want to develop a microcontroller based system which can communicate with PC/Laptop through USB port. (As simple as possible eg. toggle leds connected to any port of microcontroller when any key is pressed from keyboard).
I worked on atmel's 8051 and atmega microcontrollers. So these families will be preferable to me.
Relevant answer
Answer
It´s possible to use any other Arduino- like plattaform. Suggestions: MBED, based on NXP microcontroller, Freedom Based on Freescale microcontroller.
If you want to make it yourself from scratch, I'll suggest 18FX550 PIC microcontroller using C language. 
  • asked a question related to Microcontroller Programming
Question
2 answers
I'm interested in creating my own WirelessHART communication network using blank RF MCUs as the Gateway and the Field Devices as part of my research. I am not an advanced programmer, but I have a general idea - done up to 2nd year BSc level as part of my BEng. So I can't program my own stack from scratch without significant work.
The stack for WirelessHART is available open-source from Nivis (http://www.nivis.com/open_source/) but I'm not sure about how to use Freescale BeeKit (as it briefly mentions) to implement the stack.
Relevant answer
Answer
I agree with Mr. Torfs about the compiler and the board, but some time one board is able to use more then one compiler (ex. keil, IAR, coocox, eclipse) and also each compiler some time have their own way to prog (ex. inc and src file in C language and how to implemented inc and src to prog is also different )
  • asked a question related to Microcontroller Programming
Question
2 answers
I want to burn a hex file of programs written in MATLAB in microcontroller chip but I can't open the hex file.
Relevant answer
Answer
On Linux and OSX you can use the command :
xxd filename
  • asked a question related to Microcontroller Programming
Question
3 answers
The attachment below are the errors that are shown when I run the simulation. Can anyone highlight to me what I've done wrong? Thanks in advance.
This my program:
#pragma config OSC = IRCIO67
#pragma config WDT = OFF
#pragma config LVP = OFF
#pragma config PBADEN = OFF
#define SW0 PORTAbits.RA0
#define SW1 PORTAbits.RA1
#define SW2 PORTAbits.RA2
#define SW3 PORTAbits.RA3
#define LOW PORTCbits.RC0
#define MEDIUM PORTCbits.RC1
#define HIGH PORTCbits.RC2
void main()
{
TRISA = 1;
PORTA = 0;
TRISC = 0;
PORTC = 0;
while (1)
{
if(SW0 == 1)
{
LOW = 0;
MEDIUM = 0;
HIGH = 0;
}
if ((SW0 == 0)&&(SW1 == 1)&&(SW2 == 0)&&(SW3 == 0))
{
LOW = 1;
MEDIUM = 0;
HIGH = 0;
}
if ((SW0 == 0)&&(SW1 == 0)&&(SW2 == 1)&&(SW3 == 0))
{
LOW = 0;
MEDIUM = 1;
HIGH = 0;
}
if ((SW0 == 0)&&(SW1 == 0)&&(SW2 == 0)&&(SW3 == 1))
{
LOW = 0;
MEDIUM = 0;
HIGH = 1;
}
}
}
Below are the errors that are shown when I run the simulation.
Relevant answer
Answer
It will be easier to understand if you could post the schematic diagram..
from the error file you attached i understood that.. you have attached a 4MHz external frequency, and you have selected internal oscillator. Test your program functionality in the PIC compiler. There is no library/header file included in your program.
  • asked a question related to Microcontroller Programming
Question
3 answers
I started my program by writing subprograms as functions in VHDL. Then I have tested them separately, and all of those subprograms worked fine. Fortunately, when I combined them and started my primality testing, I found that my program was performing well, but for certain number, the program began to output all the results as composite. I was just wondering what problems might cause this bug. By the way, my program was designed to be 32-bit primality testing. However, the program work fine until I test the numbers above 46399. Then all prime and composite numbers outputted the same result as "composite". This really confused me. Please, need your help.
Relevant answer
Answer
Let's assume your algorithm is right
That is, you've got the one you've implemented in VHDL working in one of Scilab, Matlab, Octave, Python, C/C++, etc.. Now use that to generate input/output golden"test vectors" for different parts of your VHDL model. Usually I try and skip this part, but invariably when using an HDL like VHDL, I need to come back and "test" the intermediate values produced by the high-level language model against the HDL model I'm trying to get to work.
Given that, then you are trying to debug your VHDL implementation.
If by "functions" above, you mean VHDL functions, please understand their limitations.
They are not like C/C++ functions, and are a fairly advanced concept in the VHDL scheme of things. Look at http://www.eda.org/fphdl/ for examples of functions that are also synthesizable(I'm assuming that you want your VHDL model to be synthesizable, but are currently stuck on getting the simulation (perhaps using the ModelSim simulator) working correctly.
I'd recommend that if you are looking for speed from your VHDL model that you use the Entity-Architecture Register Transfer Level(RTL) methodology to design your parallel components, Embrace the clock, pipelining and their semantics, as that is is where your parallel speed will come from. I only use functions and procedures as semantic sugar until I'm comfortable that my basic design works with memory, logic, pipe lining, and clocks.
alan
  • asked a question related to Microcontroller Programming
Question
3 answers
What is the difference between CCS and IAR and which one is better to use? Can anyone help me how to design FIR or IIR filter using MSP430?
Relevant answer
Answer
Sandeep, IAR is more user friendly, CCS initial settings are a bit complex. But once you get familiar CCS is also quite comfortable. I have heard from a senior TI person that, TI has a plan to stop IAR support. If that is true, its better to use CCS. These filter designs are available in the example program at TI web-site
for each MSP430 part.
  • asked a question related to Microcontroller Programming
Question
1 answer
In rural areas of India due to over flow of water tanks, a huge amount of water and electric energy is being wasted every day which led to affect our environment. For this we are trying to design a very cheap ultrasonic sensor based water level measuring device through which we can save huge amounts of water as well as electricity. But the problem is that to measure the water level we have to put the sensor in the tank. Condensation of water may happen at the surface of sensor which generates sound waves.
Is condensation of water on the surface of sensor hamper the sensing ability of sensor?
If so, is there any preferred solution to the problem?
Relevant answer
Answer
I have worked with project that is related to your work as using optical sensor and ultrasonic sensor to measure water level .... So for more contact me
  • asked a question related to Microcontroller Programming
Question
6 answers
I designed a system that has an 8bit PIC microcontroller with a built-in 12b ADC. I know that, by 256x over-sampling, you can increase this ADC resolution to 16bits. This is done by Sigma-Delta modulation. There are wonderful articles on TI, Microchip, ADI's websites describing Sigma-Delta modulation. . My favorite is the one from ADI (Analog Devices): http://www.analog.com/static/imported-files/tutorials/MT-022.pdf
also MT-023 ... Although the description of the theory is absolutely wonderful, I could not find a single article on Microchip's website (or, any other company's) that explains how I can do this in SOFTWARE.
By using my 8bit PIC uC-based system (specifically, PIC16F1783, but, it doesn't matter which PIC), I am perfectly fine with losing my sampling speed. 75 KSPS is what this uC supports at 12bits. 256x oversampling will drop me down to 300 SPS to increase the bit depth from 12b to 16b. I am perfectly fine with that. My specific questions are:
*** Do I need additional hardware to do this ?
*** If not, does anyone have C code to achieve this ? from PURE SOFTWARE ?
*** Assembly code is totally fine too ...
Relevant answer
Answer
Hi Tolga,
you write about an interesting PIC Project. I have no real solution for a Delta-Sigma with 256x oversampling on PIC16xxx, but some suggestions:
After oversampling the analog signal you need digital filtering to reduce the noise and to achive 16Bit resolution. Digital filters are the main Job of DSPs, so consider to use a DSPic (or a better DSP, if you need a higher sampling rate).
I remember some application notes about digital filters on DSPIC in the web, some with C-Code exampels. Google the www websites for more details about it.
kind regards,
Hans-Rainer
  • asked a question related to Microcontroller Programming
Question
4 answers
Currently I am working on Pipe inspection robot.
This robot will move into pipe and inspect any damage into pipe or not ?
Relevant answer
Answer
Thank for your reply sir
i want to interface small IR camera whose size is less then 3-4 cm
because i want to move my robot in to 20 cm diameter pipe
can you suggest in future which sensor i will build up on it
(except Temp. sensor and pressure sensor)
  • asked a question related to Microcontroller Programming
Question
9 answers
At the moment I am totally dependent on PID Algorithm to stabilize my Quadrotor. It seems slow to react and to solve errors. If I increase the P co-efficient of PID it becomes highly unstable. I am using Arduino MEGA as my main controller to look after the Controlling Algorithm. Can anyone suggest a more effective control system which can run on my ATMEGA 2560?
Relevant answer
Answer
P+D usually works well unless you need a highly maneuvrable craft, then you need one of the more advanced methods. Have you separated out the attitude loops from the position? You should not need any integral action. If you increase your P gain you must also increase your rate feedback to increase the damping and so maintain your stability margins. You can increase it until the rotor demands start saturating the rotors (max speed or stall).
  • asked a question related to Microcontroller Programming
Question
3 answers
I want to plot a nyquist plot for a filter constructed using op-amp. Suppose, if I do not know the transfer function of the filter or its order.
1. Draw the bode plot of the filter which includes Magnitude and Phase responses for 0<w<inf.
2. From the magnitude and phase values, find the complex value for each frequency.
3. Plot Re vs Im.
Is this a correct method?
Relevant answer
Answer
Dear Mr. Wangenheim,
Thank you for the information.
Dear Mr. Enzmann,
I am preparing a list of experiments in control systems using microcontrollers for Master degree students. Thank you.
  • asked a question related to Microcontroller Programming
Question
4 answers
I would like to find a way to set the time the LED stays on and also set the time the LED stays off in real time. (So I am avoiding the use of the "Delay" function in favor of millis.) But I just can't wrap my head around how to set these two variables seperately without using "Delay."
Relevant answer
Answer
You can do something like this:
void loop(){
// Define the variables
unsigned long onTime 100000; // Defines the time that the led must be on
unsigned long offTime 500000; // Defines the time that the led must be off
unsigned long startTime, elapsedTime;
// Initialize the elapsedTime variable
elapsedTime = 0;
// Get the current elapsed time since power on
startTime = millis();
// Now we turn on the led
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
while (elapsedTime<onTime){
elapsedTime=millis()-startTime;
}
// Initialize the elapsedTime variable
elapsedTime = 0;
// Get the current elapsed time since power on
startTime = millis();
// Now we turn off the led
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
while (elapsedTime<offTime){
elapsedTime=millis()-startTime;
}
}
Best regards
Diego B.
  • asked a question related to Microcontroller Programming
Question
2 answers
I am thinking about writing a simple lab practicum for students of informatics (computer programming course) for assembly programming language.
The problem I am having is to identify the best architecture, mainly due to the large number of different instruction sets, address handling, program flow etc.
I have identified three possible solutions and I would like to read about other people’s experiences in this matter.
* The first solution would be to use simpler microcontrollers as the platform because of their simple architecture and reduced instruction set. Also, because it is simple to make them interact with surrounding peripheral devices attached. I believe that this freedom of playing with real physical devices would be interesting and motivating to students. On the other hand, I am afraid that this approach would teach them that computers are programmed to make other devices move around, switch on-off, communicate simple commands etc. whilst on the other hand, sometimes, programming is all about manipulating data, taking inputs and creating outputs, and most of the time, doing it all in memory (compression algorithms, encryption, decryption etc.).
* The second solution would be to go straight to real PC architectures, but not to AMD Phenom or Intel i7 processor instruction set assembler languages, but instead to older Intel chips from the 80x series. This way they could learn the real way x86 architecture works and how it had evolved into what it is now. For this solution, I am afraid that it might teach them outdated ways of coding, stack handling and that it would not give them an opportunity to learn about parallelism, optimizing code for piping etc.
* The third solution would be to design new computer architecture. Of course, to create an emulator that would execute programs written using a whole new instruction set, designed solely for that new computer architecture. This architecture would have a RISC instruction set CPU, a simple limited memory, interrupts, virtual hard drives and other types of permanent memory, input and output devices (all simulated by means of interfacing with physical peripherals of the host machine) etc. By designing a new architecture, I could combine bits from microcontrollers, such as the possibility to directly control virtual devices (step motors, lights and other devices) connected to different kinds or general input output ports, UART etc. while I could also keep all the good things of PC architectures, such as more complex memory handling, parallelism. I could introduce virtualization, etc. The reason I am unsure is because this looks like a very big project and am unsure if it would be an overkill to do something like this, although it is not too complicated, it would only take up too much time.
So there were my three ideas for solving the dilemma (`trilemma`) regarding the question on choosing the best architecture to begin teaching beginner students in programming assembly by preparing a course practicum.
I would like to hear ideas of others and would be grateful for any suggestion from those with experience in this or similar topics.
Relevant answer
Answer
Thanks for your answer. However, I have already decided regarding this topic that I will be using MIPS architecture as the basis for the new course. Nevertheless, thank you.
  • asked a question related to Microcontroller Programming
Question
10 answers
In a single ATMEGA16 microcontroller we have 4 ports and each port consists of 8 pins. The total number of pins that can be used for accessing each port is 32. But in my hardware implementation I need to give signals to 60 pins. So, can someone explain how to synchronize two microcontrollers?
Relevant answer
Answer
Your pulses are not analog! Your pulses are digital and must pass thorugh a gate-driver to feed the IGBT switches. For driving such amount of signals (60) it is better to use an FPGA. FPGAs are capable of doing parallel processing, they have many I/Os and can drive all your switches simultaneously. There should be no problem if your control logic is implemented in an MCU and then sent to the FPGA. Otherwise consider using a bigger MCU, but know that the FPGA will simplify your life. Splitting the low-level control in several MCUs is not very convenient.