Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - kristofferis

Pages: [1] 2
1
mc-Studio / ListOfInteger and debug
« on: February 11, 2017, 01:57:30 pm »
Hello.
I have continued my work with an old project that I never finished, but now i run in some issues that I did not have when i worked with this project. That was many version away so that is ok, but maybe anyone knows what's going on with my code.
I have made a very simple test code to verify the issue.

Code: [Select]
Class testar
    Shared Function test() As Integer
        Dim testTable As ListOfInteger = {0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920}
       
        Return 1
       
    End Function
   
    Shared Event start() RaiseEvent Every 1 Minutes
       
        Dim result As Integer
        result = testar.test()
       
    End Event
   
End Class

If i debug this on the virtual device:
I get error message: Can't read the data from the device
It is at
Code: [Select]
Dim testTable As ListOfInteger
If i debug on mcModule 110:
System.OverflowException (attached)

If i comment out
Code: [Select]
Dim testTable As ListOfInteger then there is no errors

So, what's wrong with my list?

2
mc-Innovations / mcModule goes IKEA Ansluta
« on: December 31, 2016, 05:12:42 am »
Hello.
I am done renovating my kitchen and after some time spending looking at different light solutions it ended up with IKEA Ansluta LED Light.
The light is operated wireless from a IKEA ansluta remote control, and that is not as smart as the rest of my house so I had to automate this lights as well.

I made a very simple solution, i opened the wireless controller and replaced the manual switch with a transistor that i control from a mcModule and MQTT, i have also added a manual switch just in case you want to change it from the automated light schedule.

The mcModule is not battery powered so no need to worry about any battery (Lplan.SetMidPowerMode(100))

I am running this in the kitchen right now but still just on a mcDevboard, i will have to create a better installation but I just wanted to make sure that it works as it should.

A very simple code for a very simple solution  :)

Code: [Select]
Define PinMode Pin0 As DigitalOutput Alias Send = False
Define PinMode Pin1 As DigitalInputPullUp Alias Button

Class IKEA_Ansluta
   
    Shared Event Boot()
        Lplan.SetMidPowerMode(100)
        Lplan.Subscribe("mcModule/000111E0/kitchen/ikeaansluta/cmd")
    End Event
   
    Shared Event SubscriptionDelivery()
        Dim msg As Message = Lplan.GetDelivery()
        Dim payload As ListOfByte = msg.PayLoad
       
        If payload(0).ToString() = "49" Then
            sendCMD()
        ElseIf payload(0).ToString() = "50" Then
            sendCMD()
            Thread.Sleep(500000)
            sendCMD()
        ElseIf payload(0).ToString() = "51" Then
            sendCMD()
            Thread.Sleep(500000)
            sendCMD()
            Thread.Sleep(500000)
            sendCMD()
        ElseIf payload(0).ToString() = "52" Then
            sendRegister()
        End If
       
    End Event
   
    Shared Event Pin1FallingEdge()
        sendCMD()
    End Event
   
    Public Function sendCMD() As Boolean
        Send = True
        Send = False
    End Function
    Public Function sendRegister() As Boolean
        Send = True
        Thread.Sleep(5000000)
        Send = False
    End Function
End Class


3
mc-Innovations / mcModule goes christmas tree
« on: December 20, 2016, 06:30:10 am »
Hello.
I was inspired from the mcThings video to monitor when it is time to water the christmas tree so I just had to implement that on my tree.

I am using a simple soil humidity detection module connected to a mcModule on a  digital input .

And a very simple code that is checking every 5 minute if the water level is ok or not

Code: [Select]
Shared Event measureMoisture() RaiseEvent Every 5 Minutes
        enableMoistureLevel = True 'turn on
        Thread.Sleep(500000) 'sleep
       
        Dim needWater As Boolean
        Dim payload As ListOfByte = New ListOfByte()
       
        needWater = MoistureLevel
       
        If MoistureLevel Then
            payload.Add("true")
        Else
            payload.Add("false")
        End If
       
        Lplan.Publish("mcModule/000104E6/livingroom/christmastree/needwater", payload)
       
        enableMoistureLevel = False 'turn off
    End Event



4
mc-Product General / Multiple issues
« on: August 21, 2016, 03:24:30 pm »
Hello.
Today I updated my mcModules and mcGateways to latest versions

V0.7-365

V0.6-361
V0.7-407

And now I have many issues, I will list the most critical here and please let me know if anyone have the same issue.

1: I can't connect to any mcModules (almost true) in maybe 40 attempts I have connected with success two times. I have tried with two different mcGateways and with 5 different mcModules and two computers. Restart of mcGateway or mcModule does not help.

2: The mcModules that was running program (send data over MQTT) does not anymore sends any data except for the beacons. The two times i managed to connect to a mcModule then i tried to debug the same program that was running on that mcModule and then it did send over MQTT so i pushed the Load program to the device but still not sending anything except beacons. The second time i was connected to a module a different one i just tried to push the button Restart From Flash but it did not get the module to work again. Pulling the battery and restart the mcModules that way does not work.

3: If i look at the beacons several of my mcmodule now has data in beaconByte 1,2,3 and 4. On the mcModules that i never have programmed to send anything there. The data is 0x01 0x07 0x6D 0x01. Why is this happening?

5
mc-Module / External IR
« on: August 08, 2016, 04:06:10 am »
Hello.
I have made a simple IR receiver/sender based on BC547, BC557.
For some reason I can't get it to work with a mcModule the IR does not send anything, if I connect it to an arduino then it works.

What is the difference between the pins on arduino and mcModule?
This is not in the code it is something with the connection of hardware between the mcModule and my homemade IR i think.

The connection is only TX,RX,3.3v and GND I am using external power to both mcModule and the IR.

Code: [Select]
Define PinMode Pin1 As DigitalInput //RX
Define PinMode Pin3 As DigitalOutput //TX

Code: [Select]
Shared serial As Uart
    Shared Event Boot()
        serial = Uart.Create(1200, Pin.Pin3, Pin.Pin1)
    End Event
Code: [Select]
Shared Event Send() RaiseEvent Every 10 Seconds

        serial.Write(0x80)
        serial.Write(0x3f)
        serial.Write(0x02)
        serial.Write(0x35)
        serial.Write(0xe9)
        serial.Write(0x0d)
       
    End Event

On the arduino I use SoftwareSerial with same baud (1200).

6
mc-Platform General / Need Beacon information
« on: August 03, 2016, 04:40:52 pm »
I am monitoring the beacons from 4 mcModules right now and i can't seem to find any pattern when and why they send out the beacon.
Let's take two of my module as an example.
One in the refrigerator and one in the freezer, they have same firmware and same code (except for the MQTT publishing name) one of them does send beacons most regularly (between the beacons) at 40 seconds the other at 30 seconds but both of them could sometimes send at 20 seconds or 50 seconds and sometimes two beacons with only a second in between so my question is how does this work?


7
mc-Platform General / Need RSSI information
« on: August 03, 2016, 04:25:45 am »
Hello.
I Am publishing the mcModules RSSI with MQTT so that I could see the connection status and all other information from the mcModules in one place.
But i need some more information about the RSSI, the devices that is close to the mcGateway is around 188-190 I have a couple of mcModules outside and one of them reports back 158.
I have one module that is also reporting 158 and if I move that device 1 meter and close a door then it does not report anything anymore.

So my question is, what is good and what is bad RSSI, it seems like this
190 - Perfect
158 - poor
less than 158 - not work at all

8
mc-Innovations / mcMarket - A place to share
« on: July 27, 2016, 02:21:43 pm »
Hello.
Wouldn't it be great to have a place where we could share our libraries with each other?
Sure, the forum works ok but it is hard for new members to find all the work that we have made.

One important part of the mcStudio is the possibility to add library code, makes the development easier, when a library code is made then you could reuse it in other projects and its easier to share a library code with other users and call the functions from the project code.
Like most of us do with the TempSensor library.

We need to have one place for all the library codes and also just the latest version available, we also need to make it very easy to download and see if there is a new version available for the code you have installed.

I have created a small program that fetch library code from a web server and makes them available for download and the program displays if there is a new version available of your installed code.

I have put together a small video of how the program works.

But before we spend some time on this, is this something that anyone is interested in? will you use it? will you share your created library codes? please share your thoughts.

What you will see on the short video is how we could see the library codes that are available, how to download, how you could see if you have the code downloaded or not, simulate a new version and how that will show in the program.

https://youtu.be/BBoLnabmDlM

9
mc-Dev Board / Lplan.Subscribe crash
« on: July 20, 2016, 08:32:06 am »
Hello.

I need to make a lot of debugging and the mcDevboard is perfect for this, I hope all developers out there have taken the chance to buy one at the good discount.

But I noticed a bug in mcStudio when trying to subscribe to MQTT then mcStudio crashes.

Simple test case:
Connect to mcDevboard in mcStudio and run following code
Code: [Select]
Shared Event Boot()
        Lplan.Subscribe("mcModule/Kitchen/freezer")
End Event

and mcStudio will crash with the error you see in the attachment.


10
mc-Module / Lplan.Subscribe error
« on: July 20, 2016, 04:28:25 am »
Hello.

I have noticed several errors when using Lplan.Subscribe on a mcModule.

This is what i have seen so far.

When using this Lplan.Subscribe("mcModule/Kitchen/freezer") then the Shared Event SubscriptionDelivery() will trigger when a message is sent to that topic, but if I change to Lplan.Subscribe("mcModule/Kitchen/#") then it does not trigger and sometimes I get error in mcStudio (could not read data...) and after I have debugged with Lplan.Subscribe("mcModule/Kitchen/#") then i can't end the debug session.
I think i did read that the # was now supported in mcModule?

I also noticed that when i run several tests with this then my mcGateway stopped to publishing to MQTT from my other devices, I had to reset the mcGateway to get that working again.

I will continue to run more tests and I hope i could collect some more data that could help but i thought it was good to start the topic.

11
mc-Module / [SOLVED] Writing to Uart
« on: July 06, 2016, 12:25:41 pm »
I am testing some simple Uart.write

This is what I want to send
t1.txt="Hello" but I also need to add 0xFF 0xFF 0xFF at the end.

So this is what I did

Code: [Select]
        Dim test As String
        test = "t1.txt=\x22Hello\x22"
        serial.Write(test)
        serial.Write(0xff)
        serial.Write(0xff)
        serial.Write(0xff)

But every time I run this code the device freezes and i receive the error message "Can't read the data from the device."

I debugged it and the problem seems to be right after doing the first Write.

I tested it also like this
Code: [Select]
serial.Write(0x74)
        serial.Write(0x31)
        serial.Write(0x2e)
        serial.Write(0x74)
        serial.Write(0x78)
        serial.Write(0x74)
        serial.Write(0x3d)
        serial.Write(0x22)
        serial.Write(0x48)
        serial.Write(0x65)
        serial.Write(0x6c)
        serial.Write(0x6c)
        serial.Write(0x6f)
        serial.Write(0x22)
        serial.Write(0xff)
        serial.Write(0xff)
        serial.Write(0xff)

But same thing happens with same error message as above.

I am using the latest version of all software/firmware

12
mc-Module / [SOLVED] Sending beacons
« on: July 01, 2016, 02:29:28 am »
Hello.

I noticed a very strange behavior from the mcModules and beacons. I started up 5 new modules and the first I did was flashing them with the latest firmware  and that was mcMod110_v0.7-357 at that point.
Started mcOTAUpdater and searched for device and installed the battery and then flashed the device, no problem here at all.

But i noticed that the device was sending a lot of beacons to my MQTT broker and with that I mean 30-40 right after each other, I did the same step with the rest (4) of the modules and same thing happened with them.
The only way that I could get them to stop sending this amount of beacons was that I had to connect them once to a broker, and that is not a big issue, I mean almost always you will connect them to a broker once you have installed a battery.
But, yesterday my gateway become unresponsive and did not send anything, no beacons or MQTT messages.
I rebooted the mcGateway and it started to work again, but now I have two devices that is sending beacons like crazy, removing the battery and install it again does not help.
This time I opened mcStudio and clicked connect on the device and I noticed that the multiply beacons stopped, I did the same with number two and it also stopped so i did not even get connected to the device but i assume that some sort of command was sent from mcStudio to the device.

I know that this sounds strange and that it's very hard to debug but I just wanted you to know that this has happened and maybe not only for me? I have seen this before but now I could reproduce it with 5 devices.

13
mc-Innovations / mcModules goes cold
« on: June 30, 2016, 04:55:50 pm »
Monitor a freezer is something that many people is interested in.
So now it's time for a mcModule to go for a ride in the cold.

I have a simple code that reads the temperature and the battery voltage once every minute and publish to MQTT.
The data is then logged to a text file so that i could see the battery voltage with a time stamp.
For this test case the battery is LS14250 3.6 Voltage, a Lithium Thionyl Chloride 1/2 AA battery that I think should work really good in the freezer.

I will update this post with some images tomorrow.

Right now (20 minutes in the freezer) the voltage of the battery is 3.589 and the temperature -21.3

14
mc-Studio / [SOLVED] Initialize a ListOfInteger
« on: June 23, 2016, 03:56:07 pm »
Hello.
I guess there is a simple answer to this but I think i have tried all possible ways that i could think of.
 This is how it could be done
Code: [Select]
Dim s As ListOfByte = New ListOfByte()
        s.Add(67)
        s.Add(68)
        s.Add(69)
But i would like to initialize the list with the integers already there like in vb.net

Code: [Select]
Dim list As New List(Of Integer)(New Integer() {2, 3, 5})
Or javascript
Code: [Select]
var crcTable = [0x0000, 0x1021, 0x2042]
The reason for this is to clean up the code, I am adding 256 static integers to the list and now it takes 256 rows in the code.

15
mc-Module / [SOLVED] Uart0Receive() Read
« on: June 18, 2016, 08:30:57 am »
Hello.
I am having some issues with the Uart Read function. As it is today .Read() Reads one character as byte so if i just send one byte then there is no issue. But let's say that something is sending
Code: [Select]
0x65 0x00 0x02 0x01 0xff 0xff 0xff
Then .Read() reads the first character and then i could loop until it gives me -1 so for the above example it will loop 7 times and if i run that in debug with breakpoints then everything is ok but as soon as i removes the breakpoint then the code misses several of the characters and it is different every time so it is some kind of timing issue.

But if it is possible I would like you to add a functions to read all the bytes that is in Uart0Receive read buffer at once maybe in a ListOfByte

Pages: [1] 2