Jump to content

StevenSegal

Members
  • Content Count

    11
  • Joined

  • Last visited

About StevenSegal

  • Rank
    Member

Recent Profile Visitors

251 profile views
  1. Just as an update, in the same sketch as the problem sketch above if I call these functions in my setup the connection is made and data is published. void setup() { Serial.begin(9600); MyCounter.start(); // start counter wifiConnect(); wifiPrintout(); } Results in the following Serial Monitor output: Start WiFi ......... SSID: HomeWiFi IP Address: 192.168.0.19 2250 testA testLoop Publishing successful! testB Why is it when I call the same function in the loop that it would cause this to hang up? Essentially I need to get this function working in my main loop.
  2. Hello all, I have recently gotten two separate functions working but when combining I am having trouble publishing data to an MQTT broker. The command "client.connect("LaunchPadClient");" is causing my launchpad to stop operation. I am using the MSP4305529 & CC3100. The libraries I have combined for this particular project are: CounterLib_t WiFi.h SPI.h PubSubClient.h The code where the problem portion occurs: void wifiPrintout() { // read the input on analog pin: int sensorValue = (analogRead(24)); Serial.println(sensorValue); // convert into to char array String str = (String)sensorValue; int str_len = str.length() + 1; // Length (with one extra character for the null terminator) char char_array[str_len]; // Prepare the character array (the buffer) str.toCharArray(char_array, str_len); // Copy it over wifiConnect(); Serial.println("testA"); // publish data to MQTT broker if (client.connect("LaunchPadClient")) { /********* this line of code *************/ Serial.println("testLoop"); client.publish("MyData", char_array); //client.subscribe("MyData"); Serial.println("Publishing successful!"); client.disconnect(); } Serial.println("testB"); } The output in Serial Monitor: 3422 Start WiFi SSID: HomeWiFi IP Address: 192.168.0.19 testA You can see the loop is never entered since the testLoop nor testB are output to the serial monitor. Originally I had problems with the WiFi connection in conjunction with my input signal on P2.2 for the timer signal used in the counter library where my WiFi would stall (the wifiConnect() command), so I moved my input signal to P1.0 and this cleared this bug up but I am still not able to establish a connection with the client. Any thoughts? Also I am sure this is all correct I have tested it in a separate sketch without the counter library and counter functions and it publishes the data with no problem.
  3. Thanks, I have been using Node-Red up until recently because I wanted a way of actually storing data but am currently looking into pulling data from Node-Red.
  4. Hello all, I am looking to stream sensor data and back it up preferably in the cloud where I can later analyze the data. I'm currently using the CC3100+MSP430. I have yet to get Temboo working properly, though it looks to be exactly what I want. If anyone has had any luck with Temboo or would make any other recommendations I would appreciate the input.
  5. @@Fmilburn This did indeed work . I will update in the other thread with my results after I do some more testing. As it stands right now it appears the data is in 10Hz increments ideally I would like to get this down, I'm sure this was unnecessary with the larger frequencies measured.
  6. @@Fmilburn Yes I am looking for some type of counter that increments by the signal being equal to some threshold. I have revamped my initial question in a new thread seen HERE
  7. Hi everyone, I am looking to write/port code to determine real-time frequency of an input signal (audio signal no greater than 4kHz for my needs) on my MSP430 F5529. After looking over interrupts/timers I feel I have a better sense of how this will tie into this project. But I am still at a bit of a loss on the coding portion when it comes to having interrupts occur at my desired frequency. High level abstract of my desired algorithm is as follows (although I am open to any ideas): A ) Enters Loop B ) Input analog signal (audio tones) crosses some set threshold (not zero due to noise/ripple even at silence) and increments a counter C ) After X amount of time: interrupt occurs calling a function that divides the previous counter from B by X and prints this value to the serial monitor D ) Counter from step B is reset and begins back at step A Questions about the algorithm above In step B I am looking for an audio signal to cross a given threshold value, is it better to sense for a rising signal in my code or just disregard half of the counter values since the signal will be sinusoidal and pass the threshold twice? Also I'm not sure I will be able to set up a direct if(input_signal == 2.xx) (where 2.xx is an threshold value in volts), so how do I sense for some window for instance: if (input_signal < 2.xx + k) && (input_signal < 2.xx - k) (where k is some value that helps determine the approximation near the threshold) without increment multiple times during a single pass? I think my last question really just relates to not fully having wrapped my head around how the main loop & interrupts will play together. In step C I will be dividing the counter (incremented value) by the time at which my interrupt occurs and finally reset my counter. This is handled by having a global variable set for the counter, correct? Arduino example w/ code An example of what I am looking to accomplish can be seen HERE, any help on porting this code or how to go about this for energia/ccs would be greatly appreciated.
  8. Is there a way of sampling an analog input (audio signal) and processing the signal with the on board ADC for input into this particular frequency counter on the F5529?
  9. Thank you for the input Fmilburn. I am looking to obtain the real time frequency values from an analog signal (microphone circuit). Considering I am not interested in higher frequency signals (4KHz would be the absolute max I am interested in, needing 8K samples/second) would I still need to utilize the pulses from P1.0. Since I am using the MSP430F5529LP in the link you sent along it says that "you have to use the upper pin of the LED1 jumper to input the signal", so do I have to physically remove this jumper and wire from the pin closer to the inside of the board to one of the pins that would be connected to a booster pack. Does the choice of pin matter in this case or in the case of where I input my analog signal? I have been trying to look over existing code using timers and have tried to look at tutorials to try and get up to speed, it does seem a bit foreign to me, I guess I had considered using code within the loop itself as the timer but after looking over things this many not be powerful enough to sense input audio frequency.
  10. Could anyone offer any info on interrupts and using the internal clock to help determine the frequency?
  11. Hello all, let me start by saying thank you ahead of time for any input. I am looking to take real time (or close to) readings of audio frequencies with my Ti Launchpad. Ideally I want to feed in a periodic signal and look for deviations in the signal. I am only interested in the frequency range of 20Hz - 2KHz. I have been looking at some previous spectrum analyzer projects others have done to display frequency bands which move with corresponding audio signals and have come up with a few questions. I would like to do something similar but output numerical value of the frequency as accurate as possible. For instance many projects I have seen as of yet have fairly wide frequency bands (obviously for display purposes) I would like to get this as narrow as possible. I am looking into FFT code implementations but am still a bit unsure on how to mold this code to meet my application and am a bit unsure where to start, any thoughts would be greatly appreciated. I am not entirely sure where I change my sampling rate values or where I set the range to sample within or if I have to tailor my input signal around a certain value. From what I have seen so far it looks like I have to offset my audio signal and center it around 1.5V with 2V peak to peak since the microcontroller can not read in negative voltage, is this a good starting point for my input signal? The exact device in question is the MSP-EXP430F5529LP (Rev 1.6).
×
×
  • Create New...