Recent Posts

Pages: [1] 2 3 ... 10
Hi All,

We have just released a firmware update for the mcGateway110 Application Processor (V0.9-958). You can find the new .bin file and change logs on our website at the following:
Release Notes:
  • Bug Fixes: An issue with MQTT messaging that could cause the gateway to become unresponsive has been resolved. This version is only released for the gateway.
Please update to these latest versions.
IFTTT / Re: IFTTT Webhook not working after upgrading to latest 0.9 version firmware
« Last post by bdevlin on August 24, 2017, 05:42:29 am »
Yes, the upgrade completely broke my IFTTT integration. I am just finalizing my switch over to MQTT. A lot of work but also learned a lot.

Old solution:
IFTTT messages from my-mods logged to google sheets. Google sheets then act as database for data visualization.

Pros: Simple and sweet.
Cons: Not very flexible within scope of IFTTT and Google. Prone to hiccups on 3rd party cloud side of solution (i.e.
IFTT would just stop receiving messages for hours, code updates seemed to tweak the column output to google sheets. 1000 row limit per sheet, so visualizations require append/union of sheets, and additional parsing for column discrepancies.)

New Solution:
MQTT JSON data published from Mc-mods. Python ( using paho and Postgres library ) script on Raspberry pi subscribes and parses JSON into a Postgres DB (also on pi) insert statement. Postgres is now DB for visualization.

Pros: more robust. Can point to a different Postgres host any time. Python allows for post-processing of data and data augmentation. Python gives much more control and allows for pretty much anything else I can imagine to do with it.

Cons: needed to learn python (and paho, Postgres libs, lots of samples out there, but googled answers frequently), more complex, but I am in control. does not seem to capture on boot prior to first publish, so first boot record is bad device date data (year 2000). Something strange with needing to connect via gateway first. Tried some boot event code with limited success. I now capture 3 dates in Postgres, device.datetime, python sub receive datetime and Postgres auto datetime for record write.

Both solutions capture and log the . I use a lookup table to join the ID for the location the sensor is located. I need to add valid-from and valid-to date fields to the lookup so I can swap out devices and still get proper historicals.

I consider my solution a beta 2. I'll post on github once I hit beta 3 or 4 if anyone is interested.

mc-Demo205 / Re: how I can to write and read data in the flash memory?
« Last post by mc-T2 on August 16, 2017, 09:44:52 am »

We will be documenting the Log functions in the next release - it will be updated within the documentation.

Glad that you have the temperature information going into Losant, this means that you have that side of things setup properly. And also good that you were able to update the device and mcStudio to the latest version.

I believe that you are using the GPS function and Log function:

if a GPS acquisition is ongoing, the log read has to wait for that to finish. Currently (this is changing when we do the warm start) both the logging and gps share a single SPI bus so they can't both happen at the same time.... This might lead to some less that elegant behaviours when debugging... for example if it takes too long for the GPS to finish mcStudio might stop and think the device is not responding...
The system will recover itself. So basically the execution of that line will be suspended until the gps acquisition is done.

Try loading the code directly into the device and see how everything works. It sounds like the issue you are having resides strictly within the debugging of the code and could be affected by what we mention above

Hope that helps,
IFTTT / IFTTT Webhook not working after upgrading to latest 0.9 version firmware
« Last post by wilsonli on August 15, 2017, 09:41:43 am »
Is it just me, or anyone here experience similar problem that, IFTTT Webhook doesn't work after upgrade mcmodule110 mcgateway firmware to 0.9-615 beta?  I verified that my webhook in is working properly if I use POST url to access it.
mc-Demo205 / Re: how I can to write and read data in the flash memory?
« Last post by gpg117 on August 14, 2017, 01:48:03 pm »

Im working with another guy on this and we have a problem with the line "lo = Log.Read(offset)". We implemented the temperature example proyect to send the information to Losant with the mcgate and it works. But when we debug the code that you passed us, debugging stops in the line of the instruction "Log.Read". We don`t know in what adress saves the information the line "Log.write(0,entry)" and if the problem is the adress(offset) to read the information.

We update the mcDemo with the firmware v0.9.615 and the release of the mcStudio is v0.9.534.0.

mc-Demo205 / Re: how I can to write and read data in the flash memory?
« Last post by mc-T2 on August 04, 2017, 09:39:57 am »

1) Have you setup Losant properly? By that I mean, have you setup the device properly within Losant and entered the correct device ID into your code for the device?
2) Have you configured your gateway properly to direct the information to your account within Losant?
3) You do need to ensure that you are in range of the gateway so that you can send the information out
4) When you first power the device, you need to ensure that it is in range of the mcGateway for a period of time so that it can capture the current time from the gateway. If you don't do this, the device will still try to capture GPS data however it will not know the time and hence, the data will not be relevant as there will be no time stamp along with it

To help, check out the below walk-through for setting up Losant:

You can also check out this video that describes the configuration and setup within Losant. The example in this video does not use the above code but should give you a good idea of how to setup and configure your equipment and their cloud to receive data:

Hope that helps, let us know how your progress
mc-Demo205 / Re: how I can to write and read data in the flash memory?
« Last post by gpg117 on August 03, 2017, 11:56:23 pm »
Thanks for your answer, it was very useful. I modified the code a little and I use SW1 and SW2  for the gps coordinates and to transfer the information, respectively, but losant doesn't receive the information.
mc-Dev Board / Re: UART console example not working on mcMod120
« Last post by rudydevolder on August 03, 2017, 03:19:24 am »
I got it working now, but only after finding that there must be a mistake in either the Dev Board or the documentation:
In the docs is stated:
16.39. Uart Class Inherits Object:    Public Sub Create(baudRate As Integer, tx As Pin, rx As Pin)
But I found that Rx comes first and then Tx.
So this works fine: ser = Uart.Create(9600, Pin.Pin1, Pin.Pin0) // Pin 1 to Rxd and pin 0 to TxD; Dev-Board default jumper config  ;D
Also something not working like it should:
ser.Write("Hello") ser.Write(0x0c) ser.Write(0x0a)    ??? this seems to give a newline but no line feed, so my line is overwritten in Putty and disappears, I found out after putting in a loop for 50 times.
when I do the following:
ser.Write("Hello") ser.Write(13) ser.Write(10)   :)    it works, how comes?
mc-Demo205 / Re: how I can to write and read data in the flash memory?
« Last post by mc-T2 on August 02, 2017, 03:14:28 pm »
There is a log function that is not yet described in our documentation. In an upcoming release, we will be releasing this information within the new documentation for mcStudio and the mcDemo205. That said, we do have some code that you can modify for your use to log information into the flash of the device. The below code is for an example using our partner, Losant, so you may want to modify this for your needs. The code is meant to log GPS coordinates and temperature and then, when in range of a gateway, you would press SW1 and the information would then be transferred to the Losant cloud to populate onto a map onto a dashboard.

here is the code and there are also some additional notes below:

Code: [Select]
Class gpsTracker
    Shared Locations As ListOfObject
    Const GPS_TIMEOUT_uS As Integer = 120000000 '120s
    'Const GPS_TIMEOUT_uS As Integer = 1000000 '1s
    Const GPS_MIN_SATS As Integer = 3 '3 sattelites minimum
    Const LosantDeviceID As String = "YOUR LOSANT DEVICE ID"
    Const LosantTopic As String = "losant/" + LosantDeviceID + "/state"
    Shared Event Boot()
        Locations = New ListOfObject()
    End Event
    Shared Event StartLocationAcquisition() RaiseEvent Every 7 Minutes
        Led2 = True
        Led2 = False
        Device.StartGPS(GPS_TIMEOUT_uS, GPS_MIN_SATS)
    End Event
    Shared Event LocationDelivery()
        Dim lat As Float = Device.GetLatitude()
        Dim lon As Float = Device.GetLongitude()
        Dim tmp As Float = TempSensor.GetTemp()
        If lat.IsNaN() Or lon.IsNaN() Then
            Dim entry As ListOfByte = New ListOfByte()
            Log.Write(0, entry)
        End If
    End Event
    Shared Event SW1FallingEdge()
        Led3 = True
        Led3 = False
        Dim count As Integer = 0
        Dim offset As Integer = 0
        Dim lo As ListOfObject
        lo = Log.Read(offset)
        While lo <> Nothing
            Dim o As Object
            o = lo(0)
            offset = o.Cast(Integer)
            o = lo(1)
            Dim dtm As DateTime = o.Cast(DateTime)
            o = lo(2)
            Dim type As Integer = o.Cast(Integer)
            o = lo(3)
            Dim entry As ListOfByte = o.Cast(ListOfByte)
            Dim tmp As Float = entry.ExtractFloat(0)
            Dim lat As Float = entry.ExtractFloat(4)
            Dim lon As Float = entry.ExtractFloat(8)
            Dim jDate As Json = New Json()
            jDate.Add("$date", dtm)
            Dim jData As Json = New Json()
            jData.Add("temperature", tmp)
            Dim locStr As String = lat.ToString() + "," + lon.ToString()
            jData.Add("location", locStr)
            Dim jPayload As Json = New Json()
            jPayload.Add("time", jDate)
            jPayload.Add("data", jData)
            While Not Lplan.Publish2(LosantTopic, jPayload.ToListOfByte)
            End While
            count += 1
            If count = 30 Then
                count = 0
            End If
            lo = Log.Read(offset)
        End While
    End Event
End Class

Additional notes -

1) you'll also want to add the temperature sensor library and the below GPS library if you want to use the code above with Losant:
Code: [Select]
Class GpsLocation
    Public Latitude As Float
    Public Longitude As Float
    Public Timestamp As DateTime
    Public Sub New(lat As Float, lon As Float, dtm As DateTime)
        Latitude = lat
        Longitude = lon
        Timestamp = dtm
    End Sub
End Class

2) I believe the flash will keep storing until you have enough data to start overwriting. If you do want to clear the flash, you can include or run the below function on a new script
Code: [Select]
3) if you are interested in working with the above code for a test, keep in mind that the device needs to be powered and in-range of an mcGateway for a suggested 30 minutes to ensure that the device grabs the time from the gateway. This is so that you can associated a time with the GPS coordinates

4) And, if you are going to use the above code and leave it unmodified to work with Losant, you'll notice at the end of the code that we have a time delay. This is due to how the Losant platform works which can only consumer a certain amount of data every 30 seconds. The time delay allows the device to send out a batch of data then wait and keep sending to ensure that Losant receives all the messages.

Hope that helps!
mc-Demo205 / how I can to write and read data in the flash memory?
« Last post by gpg117 on August 01, 2017, 09:33:13 am »

I want to know how to write and read data in the flash memory of the McDemo205
Pages: [1] 2 3 ... 10