-
Thanks Gordon for having a look into it. I looked through the API reference and figured maybe I could use peek/poke if I am stuck. I am not under any pressure. Just checking all the functionality before I start designing PCB for my little project.
I am using USB scope for probing signals. Great for home labs, it has waveform generator and other useful stuff digikit.
My guess is that the analogWrite function sets more than just updating the duty cycle value and it resets the timer. Maybe selecting option for frequency is doing that. For that servo I need to use around 20ms anyway.
I saw there are some modules available for driving motors so I will test them all and see. I am curious about the stepper motor driver for nrf52. -
Hi all,
I am seeing the same thing after updating to cutting edge. I am using just one PWM for driving servo and updating value periodically (feedback from a pot tied to adc). The jitter with default hardware timer is massive. After selecting software is smaller, around 50us but that still means servo doesnt settle completely. Also once in a while it spikes to even bigger value.
I used the code from one of the examples for servos:function setServo(pin,pos) { if (pos<0) pos=0; if (pos>1) pos=1; analogWrite(pin, (1+pos) / 50.0, {freq:20, forceSoft:true}); }
Ideally I would like to be able to use hardware timers as they shouldnt jitter if the timer doesnt reset or something. You can see that when you dont update periodically the PWM then its rock solid.
I am planning to use a servo, few dc motors and a stepper so its going to be an issue.Is there any other way with more low level control to update PWM's values?
Thanks
note: I did check without adc feedback with hardcoded pwm value so it doesnt come from the pot.
-
-
Accelerometer would measure zero in every axis if there was no force acting for any axis. When you dont move you have the gravity force pulling you down and accelerometer measures that (if you are not floating in space). Try applying any acceleration (fast movements) in any axis and you will see that too. Here you have app for banglejs plotting accelerometer so will be easier to see that https://kristosb.github.io/WebBangle/
If you want to sample fast, accelerometer will be better option than GPS. Accelerometers have different ranges. Some are better for measuring earths gravity (low range) other better for high forces like in an airbag. It depends whats your application. -
-
Yes, you could test it with your phone first.
@Gordon suggested laser sensors which would be my choice too.
I am wondering what do you want to use the ranging for. From your initial project description I suspect you are trying to not only get rotation/inclination but also translation (moving in line)? If thats true I think this project might be more challenging. You get into stuff like SLAM and sensor fusion. -
Maybe not the most straight forward answer but you should be able to get it running based on those two posts.
First is Web Bluetooth app connecting to a gyro device and visualising using three.js. Its not an espruino device but you should get the idea.
http://forum.espruino.com/conversations/347308/#comment15271498
Second is Web Bluetooth app connecting to espruino Bangle watch and visualising using tinydash.
http://forum.espruino.com/conversations/346860/#comment15254612So using bits from both examples you should be able to do what you want. I want to make a version for the second demo using three.js but its not going to be any time soon.
Hope that helps.
-
-
-
-
Thanks Gordon. Global setting might just add complexity and cause problems somewhere else. I am fine with what I am doing now as solution. I thought it might be good idea to rise this topic so developers make the fonts more readable sizes.
For the BTN2 disabling seems nice solution. I wont have to edit apps and having sequence to launch menu makes it child proof as well :) -
Hi Everyone,
Is it that I am old and my sight isnt so great anymore or some widgets/apps fonts set to size 1 are just too small to read. I ended up editing Gadgetbridge, morphing clock (seconds) and weather widget font sizes so I can see them. I wonder could that be solved with some setting for at least widgets to make them bigger.
Another thing that I change for clock apps is the middle button launcher. I press it accidentally when tilt my wrist all the time. I changed the launcher to BTN3 but then for that app you cant exit menu with BTN3 so I just relaunch.
I wonder what are your thoughts on this and maybe have better solutions.Thanks!
-
-
Hi Everyone,
While waiting for my espruino boards I dug out my old miraprism AR headset in attempt to hack the controller. Controller has touchpad, buttons, gyro and accelerometer. I always wanted to do that and now figured maybe there is a chip inside supporting espruino. I opened it and there was nRF51822 inside with nice SW programming connector on the PCB. After looking through the forums 51 series doesnt support the espruino fully. Maybe you can have more comments on that how hard would it be to flash it.
I thought I will try to hack it anyway by sniffing the services and characteristics so I can write web bluetooth app to use it. I found some people were able to hack the google daydream which is similar controller.
https://hackernoon.com/how-i-hacked-google-daydream-controller-c4619ef318e4
https://github.com/mrdoob/daydream-controller.js
I based my web bluetooth app on the second link. Miraprism doesnt have much info but I found out that the guangdong company that was making the controller for them made their own which is identical and its called ximflip. I think they made similar headsets/controllers under different names or for different companies. There is a lot of documentation available including BOM.
https://fcc.report/FCC-ID/2ALLR-X3C01
Note that comparing to the daydream they dont have the magnetometer so they have to calibrate their controller position.
I spent two evenings and I think got quite far but dont want to get stuck in the rabbit hole especially that I would prefer to get the espruino working there. In original daydream they where sending all axes mag/acc/gyro in raw values. It was challenging to figure out the bits in the whole frame.
Its different with ximflip. They by default send 3 bytes 2's complement per axis rotation. I was wondering why the value goes from -1800000 to +1800000. Then I looked through their higher level SDK. Its only header files and main, the rest is compiled. You can see there that the accuracy of rotation is 4 digits.
https://github.com/Ximmerse/SDK_Flip/tree/d10cc0c0ef8d9a5e12f8e0bbd1115ea7199325b2
So I realised if I divide the rotation by 10k I will get +-180.0000 deg. One of the axis behaves different. Thats the point when I got stuck. Also I bet to get the raw acc and gyro you need to send command through F002 characteristic but couldn't figure out that either.
Anyway, that was fun. Here is the repo where you can try out the code if you get controller.
https://github.com/kristosb/WebXimflip
https://kristosb.github.io/WebXimflip/
Here I found a controller that should be a clone of it:
https://www.amazon.com/Beracah-Controller-Wireless-Bluetooth-Gamepad-Daydream/dp/B07DD5N6ZT/ref=sr_1_4?dchild=1&keywords=daydream+controller&qid=1589203626&sr=8-4Cool feature of this controller is touchpad which works quite well.
Thanks! -
-
Hi all,
Just starting with espruino. I was working on some hobby project involving esp32, web app and bluetooth communication. In the meantime my pebble broke down and I looked for alternatives. Bought myself bangle and started messing around with espruino. Since then I order MDBT420Q module and moving my project to it. The learning curve is incomparable. Also I recently started learning JS anyway so it works out great.
I have some watch apps developed but nothing worth sharing yet. Here is my first web bluetooth exercise project. I want to add all bangle sensors to the GUI. So far its only accelerometer. It took me one afternoon and I am just starting with JS so quality might be poor. I had to make a small edit to puck.js to add connection.off() method.
https://kristosb.github.io/WebBangle/
Since I am new to espruino and JS here is a question:
I used low level event readout and set up interval on the bangle sending acc out.connection.on('data',...
How would you set up readout for sensors that have different intervals plus sensors that just need the single readout on action?
Thanks!
cool, that was super fast :))))) I will give it a go and let you know. Thanks again!