5 ms·
What do you think about it?
by gioscarab 11y ago
What do you think about it?
- dnet 11y agoI see that it uses Wiring, but I'd be interested what the minimum requirements are for a compatible implementation. For example, would it be possible to implement it without some serious bit hacking on an ATtiny? (For example, ATtiny2313 has 128 bytes of RAM -- bytes, not kilobytes.) I see that the source code has plenty of comments, but a specification be much more readable in a separate Markdown file or (GitHub) wiki page.
- gioscarab 11y agoThank you so much for your feedback. I think the first step on ATtiny compatibility can be ATtiny85 with a decent port on wiring. (I think will work also without external oscillator using only internal PPL clock tuned to 16mhz). I am thinking to open a wiki defining the standard to enable people like you to build easily an implementation for a still not compatible device. Why don't you open an issue on github and we will all speak together there :)?
- bborud 11y agoMaking it work for ATtiny85 would be very neat. I've never tried to run it at 16Mhz without an external oscillaror -- only 8Mhz. Would it be a big problem to run the network at half speed? (ie to make it configurable)
- gioscarab 11y agoI am quite stuck in that, to get acceptable speeds the speed has to be known at compile time and defined with #define I think can work at standard speed on Attiny at 16 mhz.
- dnet 11y agoDone: - https://github.com/gioblu/PJON/issues/12 https://github.com/gioblu/PJON/issues/12 - https://github.com/gioblu/PJON/issues/13 https://github.com/gioblu/PJON/issues/13
- gioscarab 11y agoThank you so much, I will write you on github! I hope you will give to PJON a try.
- mynegation 11y agoI am sure people in the know recognize what it is, but for the rest of us: what is it and what is the significance? Is it for communicating between Arduino and devices through a single wire? Why is it better than two wires or wireless?
- gioscarab 11y agoHi there, this is a communication bus system, that transfers data between computers. What is interesting is that is completely software (no usage of hardware components of the microcontroller that could make it difficult or complicated to port to otherones, infact is compatible with Arduino Duemilanove, Uno, Mini, Nano and Mega) and opensource. Using 1-Wire you can obtain similar results but in my opinion with a cumbersome implementation using a product of Maxim engineered to interface other Maxim products, containing a lot of useless junk for the fast majority of opensource applications. If with two wires you mean Serial or i2c: - Serial has only a physical layer and there is no acknowledge or check if the message correctly arrived to the receiver. Infact you can see in the arduino serial monitor junk arriving as first characters, before the connection starts to be stable. With Serial you can connect only 2 devices one to the other. - i2c is a product of Philips and is closed source. Its range is limited and is mainly engineered to connect integrated circuits together on the same board, so is not the right choice for home automation applications, or automotive. PJON is a system that let you connect up to 255 arduino boards together and has a packet manager that handles all the packet sending and retrasmissions. It is also able to detect network errors, and ask for resend. Every Arduino has an ID and can be contacted from another device in the network. Speaking about wireless you can find in my github profile ASK_Slang that is a old version of PJON ported to work with a Radio 433Mhz physical layer, using cheap 3 dollars TX RX 433Mhz pair: https://github.com/gioblu/ASK_Slang https://github.com/gioblu/ASK_Slang ASK_Slang is in early beta, I am still working on it :)
- antoinealb 11y agoWhat does the `accuracy` measurement on your benchmarks show ? How did you estimate max transmit distance of 50m. I know I am pretty negative but to me once you reach this level of complexity in your applications it is time to move on to microcontrollers with proper networking capabilites such as CAN, Ethernet, etc.
- gioscarab 11y agoHi there. PJON has networking capability, and it is designed as it is to be easily compatible with Arduino compatible devices. It contains the vast majority of patterns and implementations you can find in other communications bus system, also the proprietary ones. I tried as much as I could to bring it opensource and free to use, clear, elegant and easy to understand. Arduino and many other embedded systems have limited memory and program code has to be efficient. For this reason I wrote PJON that includes an entire communications bus system or communication network in 350 lines of well commented code. For sure for me was a project oriented to have the knowledge on how a communications bus system is built and which problems an engineer faces writing a new one. After this process, using and testing it I obtained great results in my home automation application and I would be happy if the community eill start to use it.
- gioscarab 11y agoI'm sorry I forgot to anwer you your firsts questions: - Accuracy is the ratio between packets correctly received and packets received with an error expressed in percentage. - I tried physically with a 50 meters long copper wire.
- jonsen 11y ago50 m might definitly lead to problems in other settings. "Because both ends of the RS-232 circuit depend on the ground pin being zero volts, problems will occur when connecting machinery and computers where the voltage between the ground pin on one end, and the ground pin on the other is not zero. This may also cause a hazardous ground loop. Use of a common ground limits RS-232 to applications with relatively short cables. If the two devices are far enough apart or on separate power systems, the local ground connections at either end of the cable will have differing voltages; this difference will reduce the noise margin of the signals. Balanced, differential, serial connections such as USB, RS-422 and RS-485 can tolerate larger ground voltage differences because of the differential signaling.", cited from: https://en.m.wikipedia.org/wiki/RS-232 https://en.m.wikipedia.org/wiki/RS-232
- kbaker 11y agoSorry, this got long... This looks very interesting as a 'simple' communications protocol, and it would be great to have one available for simple multi-master applications. This one is very close, most of the major things are there. I think you should look at some things from other common protocols to increase the robustness. Especially CAN (especially single-wire CAN J2411), RS-485 multi-master, and 1-Wire. Here are some thoughts: - Increased Synchronization / Sampling: Async serial protocols usually sample at 16x the bit rate to determine the sampling point (CAN is 8x?.) You should increase the number of samples taken during synchronization. Clocks nowadays are much better than they were, especially using a crystal oscillator all the time, but you should still try communication +/- a few percent and make sure it is still robust. Look at this article for more information: https://www.maximintegrated.com/en/app-notes/index.mvp/id/2141 https://www.maximintegrated.com/en/app-notes/index.mvp/id/21... Also, a some implementations will 'vote' on the majority value before determining the 0 or 1, i.e. sample 8 times during the bit and return the majority value. This helps with noise resistance. - Use of timers and interrupt-on-change: This one might turn out to be a lot of work, but it would be nice to see an implementation that uses the timers and GPIO interrupts instead of using delayMicroseconds(). This will give you much better timing accuracy for sending and receiving, and frees up the processor to run an OS or other code in the background without having time taken out to watch the network and spin in delays. Also it doesn't necessarily ruin the timing when other interrupts are running at the same time. I have not done a lot of Arduino work though so I don't know how closely this would fit into the ecosystem... can you configure the timer/interrupt priority to use? Do all pins support interrupt-on-change? - Better CRC/checksum: XOR CRC is not the best, as it is not as resistant to multiple bit errors. There are good, free algorithms for CRC checking. Look into pycrc which writes all the C code for you. https://pycrc.org https://pycrc.org - Physical layer: add a small capacitor to simulate a long bus or many connected nodes. Simulate some bus faults. You should definitely look into getting an oscilloscope for this one, it can be very illuminating. Can you detect faults, by reading from the input while driving, to make sure the line is really what you want it to be? I'm not very familiar with AVRs but I know PICs could do it. - Some way of auto-addressing: it is a pain to address things on the bus manually, to reprogram devices every time you want to add some more. Look into some sort of addressing scheme (similar to how 1-Wire handles addressing.) Maybe just a 64-bit random identifier and some sort of bus enumeration? Especially since there is no way to detect address collisions on the bus. - At least wait 10 bit-times of zeros before returning with no collisions, since you can send 9 zeros normally (10 00000000)