-
So is it that problem? That sounds a lot more serious than just a delay to me...
I believe so, I was able to make the dsd6 run slower just by making the signal worse, and eventually it was rebooting when using puck.js.com script. But I did not want the cli to be exposed anyway, so the NRF.updateServices solution is better in any case for real use, I did not investigate further. I can try something if you like though, I have a nice visual feedback of the delays to reboot sequence, the ball moves slower and then stops :)
but I do not have the probem anymore, the NRF.updateServices way solved it for me.
-
Oh, ok - well that's expected I think. It's not really a crash.
nice, yes that is was I understood was happening, I was overdoing it, was gettting greedy because I was playing with your tiny dash and it was fun :)
thanks, sory for not making my self clear, it is not a problem for me, I actually swiched to running NRF.updateServices 16 times per 1 sec, one variable after the other, and only send the ones I want to be instant every 100ms, while running all the rest of the code for the toilet empty cycle, and your amazing software is not breaking a sweat on the dsd6 :)
https://github.com/enaon/sCat-a/blob/9109221dd977e7d7467cf9cbc1442445a11c7e53/app/main.js#L16
-
-
I used the code Gordon has here(*), the write command I was sending to espruino for the loop was this one insted of the one on the example, so it was quite big, not as big as it looks ofcource, I was just returning the id and numbers,a json, but is was not a problem at all if the signal was ok, the script (http://www.puck-js.com/puck.js) was handling it nicely, only when signal was near lost the dsd6 was rebooting. 150 ms interval.
if you use this github example on a phone with an espruino device, and add some code so that you can see a led go on and off at every interval run on the device, you will see it blinking slower as you make the make the signal worse. If not, then it is strange, maybe it is an older problem, but it sounds strange that it not known, even if solved.
connection.write( "lal=setInterval(function(){Bluetooth.println(JSON.stringify({dt:Date().toString().split(' ')[4],uv:scata.state.def.auto.uvc,ps:scata.state.is.sys.pause,bs:scata.state.is.sys.busy,db:scata.state.def.is.dbg,ac:scata.state.def.auto.clean,ad:scata.state.def.auto.delay,rtod:scata.state.is.sys.run,pos:scata.state.is.pos.ball,pwr:scata.state.is.sys.pwr,lit:scata.state.is.volt.litres,pbv:ew.is.ondcVoltage(),ss:scata.state.def.sandType[scata.state.def.is.sand].speed,sp:scata.state.def.is.sand,cb:ew.is.batt(),pb:ew.is.ondcVoltage(1)}));},150);NRF.on('disconnect', function() {clearInterval(lal)});\n",
-
I will try if you cannot replicate it there, the version on dsd6 indeed only has standard BT packet length, but if the signal is good, it works fine for days connected. I only realized because I was getting random reboots, and could not figure out why. It turns out, I was not closing the connection from the phone, and when I was moving a floor down the toiler that was upstairs was rebooting :)
I can demonstrate it for you if you like, I was able to make the empty cycle run slower just by placing the phone between my legs so that the signal got worse.
I swiched to using characteristics and standard web bluetooth connection, and the problem is gone now for me, but I will make a small video if you believe it is usefull. If you are sure it does not affect newer vesions, then it is not problem.
-
my bad, I wrote puck.js, I meant http://www.puck-js.com/puck.js, the script for communications you offer.
there is a loop locking problem for sure, I have verified it using espruino 2.14 on the p8 watch, I will try to explain better.
when using the code on this example* for communicating from a web page to an espruino device, two way comms, say sending from the device to a web page a string 40(so that the info gets split on 2 or more packets) characters long every 200ms, all is fine as long as the signal is strong. When the bt signal goes low or near lost, the espruino device reboots. You can verify it very easily, just have a led blink on every loop on the device, and force a bad signal on the phone running the web page. You will notice that the led blinks slower as signal gets worse, and eventually a reboot will follow.
I used characteristics and all is ok for me now, just reporting it in case you want to test.
-
@jmontane sorry for the delay, I have uploaded the code to github, the main app file is here:
https://github.com/enaon/sCat-a/blob/master/app/main.jsI also used the espruino tinydash to make a small control app
ps. @Gordon, I had an issue when using puck.js for the comms, maybe it is due to my espruino version on the dsd6, or maybe it is a known issue, I am reporting it in any case. The problem is that the dsd6 was freezing/rebooting when communicating using the puck.js and the signal was low.
-
-
If you just want nrf52 device with battery and screen and don't mind taking it apart to get GPIOs then the Magic3/C17 is cheapest and is even nrf52840 and relatively easy to open (price is about 11EUR with shipping and taxes from aliexpress)
I wanted to ask you, I will have a look myself, but did you happen to find any unused pins on the board, like you did for the dsd6 back then?
-
hello @jmontane, yes I will upload the code to github, and will make a final parts list for the electronics.
as for the controller, I was thinking about it a bit too. @fanoush may know of a band that could work and is still on sale, or maybe an official espruino board could be used, or even an esp board if battery operation is not importand, or maybe have it in sleep mode. (I have not yet done any proper measurements, but the prototypes are now 2 months in, 300+ empty cycles, ~65% battery level, idle consumption of the powerbank module looks good)
I used the ds-d6, because I had some, Ι wanted the controller to be waterproof and it was easy to use the accelerator for sensing movement, but I will use the magic3 (*) next, I will place it on the top of the power bank/motor cover, it is removable so it makes sence for easy deep cleaning, and I will use a shaking vibration sensor- Ι am not sure how they are called, little glass capsules- for the sensing part, so maybe you could get one of those, the code for it will be on github too, with menus etc.
I plan to upload the current code for the dsd6 on github by monday.
(*) https://forum.espruino.com/conversations/347237/?offset=50#comment17292219
-
-
maybe some delay between connecting and reading data could help, I think there is MTU negotiation running right after device is connected, but it is there too also even for SDK12
thanks, I think I remember talking about this in the past, adding delays did help, it now allways connects, but only if the interval is 7.5-100, 7.5-7.5ms will not work on the bangle js2 for me, nothing like the p8 or the magic with 6.0.0. Strange, I will play more., thank you for your time.
Edit: I just used 6.0.0 in the magic with 2.21, it behaves like the bangle, connects if delays are in place but not in 7.5 ms, comms are slow and it disconnects every 5 secs or so, strange, I think I remember that it was related with the feature of multiple connections that was introduced some time back, but I may have it mixed up in my mind.
-
sory to spam on this thread, last one :)
This is what I am getting (most of the times, some times it conects) on the bangle2 2.21 when trying to connect to a unicycle using my scripts.
Uncaught Error: Unhandled promise rejection: Disconnected
Uncaught InternalError: BLE task completed that wasn't scheduled (SERVICE/NONE)
Uncaught Error: ERR 0x8 (INVALID_STATE) (:2082)is bangle using 6.1.x too?
-
You mean S140 6.1.1? and you reduced writing block size to 2048?
I think so, it is the one you have on your github, and I think I managed to reduce the block size to 2048, I am not very sure I did it right though.
It works, but I am facing some issues when connecting to my unicycle, I think I have seen the same problem in the past, I remeber that I was able to overcome it, but I need to remember how. I have the same problem with the bangleJS2 on 2.21, so it seems that it is not magic3 related, the bangle has very simmilar behaviour ( I am using 7.5ms connection interval) .
The connection takes some more time, and it feels like there are two of them at the same time, one goes through and one fails, causing my script to restart comms, but it maybe be something else, I will play a bit more.
also, I did loose the advertising of the magic(2.21 /6.1.1 -and I tested 6.1.0 too, the same as 6.1.1 as far as I can tell) two or three times, I am not sure what caused it, reset()/E.reboot() did not help, I had to use the watchdog to restart, and then it was visible again.
I have a disable/enable BT switch on the gui, this does not work too, if I disable the BT it will not be visible once enabled, reset()/E.reboot() does not help, only the watchdog works for restoring incomming connections. (this also aplies to the banglejs2, so maybe it is espruino 2.21 related -Edit: disable/enable BT using the bangle os bluetooth connectable menu works, so maybe something has changed and the way I do it is not correct anymore.)
-
-
-
super, thanks a lot, I am still on 6.0.0,because 6.1 was messing up the flash :)
also, do you remember the version the compiler change happened? I just tried 2.17 and your driver works as it was.
edit: I tried the inline driver with 2.21 and the changes you mentioned, but it outputs a "Compacting.." message on the ide when I am uploading, and after a while it disconnects, I think it softbricks, I do a reset using the watchdog to connect again.
Maybe I did something wrong? I just replaced all E.toString with E.toFlatString, and used var bin=E.toFlatString(atob(".....")) ( I also used E.toString, same result)
-
hello @fanoush, I tried a build of espruino_2v21.9 on p8 and magic, and it seems the inline display driver gets broken. The watch boots, but displays only the last screen that was on before the firmware upgrade. Is there something I could maybe try?
Actually I just wanted to try the jit feature, just to test if it could speed things up a bit, do you maybe know of a version of espruino with jit that your driver works?
-
-
I've got a laser cutter here so building nice cardboard parts should be pretty easy.
You make me feel like a caveman, I didn't even use a ruler, If you make something please tag me, I am curious.
I am leaving this here too, the electronics, dead simple. The nice thing is that the powerbank module I used has a very nice feature, it turns off if the output is shorted or overloaded, but turns on again on a button press. The button is sensitive to pulses greater than 100ms, so it does not interfere with the servo.
this demonstrates a power loss and an overload, the logic only has to recover power, cutting off power to release the servo in a case of overload is done by the power-source, fail proof.
-
-
Hello Gordon,
there are some ready made products, but they all use a quite bigger ball and the whole cat enters inside, there is not a ball based one that half the cat is outside. I think most if not all are not really cleaning/maintaining friendly machines for a toilet use, some are ok, some are really bad designs, I am proud on how simple/clean this implementation turned out to be. It is battery/mains powered, 6 months of 10 emptying cycles per day is my estimate on 8 18650 batteries, but I will know for real after I run some test during this weekend, and is basically water proof.
the dsd6 has the serial on the usb, it turned out that I can controll 2 servos, 2 relays and the powerbank using just those two pins, so I did not opened it up, it is a standard dsd6. I went for the dsd6 because there were many problems to solve, I wanted the controller to be really simple in the first go, the dsd6 and espruino made the controlling part a breeze. I made a custom lock that also transfers vibrations from the ball to the dsd6, so the accel is working fine for cat presence, I am using the tap feature of the accelerometer at 2g force sensing, every trigger resets the 2 minutes counter. I also monitor voltage drop during the emptying cycle, I found out that I can relate drop to sand weight quite well, so it knows how much sand is in the ball, and this also serves as a "something went wrong" alert. I also run the dsd6 power in through a reed switch that is disabled when the drawer is missing, so it has drawer presence sensor , 5 volts is power on, 0.6 volts is power off( powerbank in sleep mode, 30μA drain), 0 volts is drawer out.
Yes, it is just cardboard, two component thin liquid construction resin, it soaks in the cardboard well, filling and sanding. The resulting material feels a bit like poly-carbonate sheets, very nice for prototyping I think, it was my first try using this technique, I recommend it. My comment on the "not the strong point" was about my coding skills, other that this espuino is rock solid, as it has always been for me, a true tool.
I have some photos of the "making of" in this greek forum, I will be happy if you care to have a look.
Thank you again for espruino, happy new year.
https://www.phorum.com.gr/viewtopic.php?t=50568&start=75
ps, this is maybe the best product on the market, but it really served as a reason to make something more cleaning friendly, I do not like it, it is not bad but it is not good either, the scoop part is not even removable, there is no way to really wipe clean the sand pocket, I am not sure the people in the cat litter robots business really have cats.
nice, yes fanoush's solution sound fine, I will try it next time I want to use the puck.js script. I had one more problem with it though, in your git example there was not a disconnect on lost signal event, it was not disconnecting when signal was lost, so I used the google way to be sure, disconnect due to low signal works fine with the google example. Next time I will ask for info :)
this is what I am using now
https://github.com/enaon/sCat-a/blob/9109221dd977e7d7467cf9cbc1442445a11c7e53/index.html
it is served from github from this page.
https://enaon.github.io/sCat-a/
sCat-a in greek sounds like shit, poop etc, in case someone wonders about the name :)