Protocol Questions

3 views
Skip to first unread message

Dimitri Koshkin

unread,
Apr 12, 2013, 1:44:59 PM4/12/13
to cssolard...@googlegroups.com
Hey so I'm starting to implement the protocol and I am confused.

Ok, I think I figured out that when it says "byte" you mean HEX, can you verify that please.

It says that the transmission begins and ends with 8 bytes or HEX numbers? That is in addition to the other 8, is that correct?

Also for light intensity, the Arduino has an 10 bit ADC, there isn't really a way to convert from the analog reading to lux, its all relative and will be tested when its installed.

--
Dimitri Koshkin
Stevens Institute of Technology 2014
MS Computer Science
BE Electrical Engineering
Alpha Sigma Phi AT
Gear and Triangle

jfrech

unread,
Apr 12, 2013, 2:33:09 PM4/12/13
to cssolard...@googlegroups.com, dimitri...@gmail.com
Dimitri,

Yes, you can say 1 byte is 1 hex character.  Basically can use the terms interchangeable.  8 bytes = 12345678 in hex

Yes, in addition.  Meaning if you are starting a new transmission for a period send 8 bytes to mark a new transmission and 8 more to signal the end (in between these two  block will be all the actual data).  Example 00000000 12345678 FFFFFFFF.  Where the 0s are the starting block, 12345678 is data and FFFFFFFF is the ending block.  Of course youll have more than just 12345678 in the middle as we should be transmitting a lot more data.  Basically just pad every single 8 hex characters with the starting/ending blocks.

Light intensity was a guess on my part as to how it would be measured.  Feel free to change the document to something that is more appropriate, whether that be a 1-10 scale or just on/off (1/0).  Or I can make the change if you let me know appropriate values that'll be returned.

Hopefully that answers your questions, let me know if there's anything else.

Thanks,
Justin Frech

Dimitri Koshkin

unread,
Apr 12, 2013, 5:48:18 PM4/12/13
to jfrech, cssolard...@googlegroups.com, Taras Koshkin, Tim Weeks, Dan Tipaldo
Ok, here it the new code with the protocol implemented for the central module. The end points will have to be altered also. Because the address of the protocol starts at 1 and not 11, that has to be changed in the code and uploaded onto the different end points.

Also like I mentioned to Justin earlier, there isn't really a way to send HEX numbers in the Arduino, so I am sending bytes instead. Because it is a byte and not a HEX I got rid of one of the bytes in the protocol so it is now seven bytes. Instead of using 2 HEX to represent the temp, humidity and light intensity values I mapped it into one byte.

Let me know if you need me to change anything else, also when can we meat so we can test this code?


On Fri, Apr 12, 2013 at 5:05 PM, Dimitri Koshkin <dimitri...@gmail.com> wrote:
And obviously the first approach, sending as strings would take much more time and space, and I dont even think the Arduion's serial buffer is even big enough.


On Fri, Apr 12, 2013 at 5:03 PM, Dimitri Koshkin <dimitri...@gmail.com> wrote:
Hey so I just realized that there isn't really a good way to send HEX numbers. I can either send the HEX numbers as strings. So 78 = "4E" string or as bytes.

What are your thoughts on using bytes instead of HEX numbers? So each message would be 8 bytes instead of 8 HEX digits.


On Fri, Apr 12, 2013 at 3:38 PM, Dimitri Koshkin <dimitri...@gmail.com> wrote:
Ok no problem, I just didn't want to do it incorrectly. 


On Fri, Apr 12, 2013 at 2:48 PM, jfrech <jfr...@stevens.edu> wrote:
My bad, you are right.  Only half my brain is functioning right now (I'm at work).  I'll fix the document, but do it in Hex (4 bits).

And yes you example would be perfect.  The reason for the padding on each transmissions is just so we know it ends incase for some reason a block is missing or something.

Thanks,
Justin Frech


On Fri, 12 Apr 2013 14:42:55 -0400, Dimitri Koshkin wrote:
Ok, still confused because a HEX number is 4 bits and a byte is 8
bits, so when I send the strings, I will do it with HEX numbers.

Also, if I am sending data from multiple sensors, so like temperature,
humidity, light and motion, I pad the string with only one set of
start and end bytes, so I would have: 00000000 12345678(temp)
12345678(hum) 12345678(motion) 12345678(light) FFFFFFFF.

DIMITRI KOSHKIN

Stevens Institute of Technology 2014
MS Computer Science
BE Electrical Engineering
Alpha Sigma Phi AT
Gear and Triangle
Email: dimitri...@gmail.com
Phone: (908)-278-4083 [1]

--

DIMITRI KOSHKIN

Stevens Institute of Technology 2014
MS Computer Science
BE Electrical Engineering
Alpha Sigma Phi AT
Gear and Triangle
Central_ModuleNEW.ino
Reply all
Reply to author
Forward
0 new messages